9.1.3.3 Workflow
- Enable the AST module:
ast_enable(AST); - Initialize the AST to counter mode:
*structast_config ast_conf;* ast_conf.mode = AST_COUNTER_MODE;* ast_conf.osc_type = AST_OSC_32KHZ;* ast_conf.psel = AST_PSEL_32KHZ_1HZ;* ast_conf.counter = 0;* ast_set_config(AST, &ast_conf);* - Or initialize the AST to calendar mode:
*structast_calendar calendar;*structast_config ast_conf;* calendar.FIELD.sec = 0;* calendar.FIELD.min = 15;* calendar.FIELD.hour = 12;* calendar.FIELD.day = 20;* calendar.FIELD.month = 9;* calendar.FIELD.year = 12;*structast_config ast_conf;* ast_conf.mode = AST_CALENDAR_MODE;* ast_conf.osc_type = AST_OSC_32KHZ;* ast_conf.psel = AST_PSEL_32KHZ_1HZ;* ast_conf.calendar = calendar;* ast_set_config(AST, &ast_conf)Note:We need to set the clock after prescaler to 1Hz.
