58
©Vecow MTC-2021 User Manual
Appendix A
A.2.4 Start to Access the MTC-2021 GPIO port
Please refer to source code for set_data () and get_data () function.
Write data to GPO (output) port
set_data (Register Index, update_value);
example :
unsigned char data = 0x82;
set_data (0xE5, data);
//Set bit 7 & bit 1 of GPO output port as High level, another bit is Low
Read data to GPI (input) port
get_data (Register Index) //It will return a BYTE value.
example :
unsigned char data
get_data (0xF1, data);
//Get GPI (input) port status on input_data variable.
A.2.5 WDT ON/ OFF and Timer-Counter setting
Refer to GPIO setting of Step A and B, located Logical 0x08 for WDT function.
Reg [0x72] is WatchDog ON/OFF control.
WatchDog On :
set_data (0x30, 0x01);
WatchDog Off :
set_data (0x30, 0x00);
Reg [0x73] is WatchDog timer – For WDT Timer out value
WatchDog counter start :
set_data (0xF0, 0x02);
WatchDog counter start :
set_data (0xF0, 0x00);
Reg [0x72] is WatchDog time-out value, “
Reading
” this register returns the
current value in the Watch Dog Counter, not the Watch Dog Timer Time-out
value..
WatchDog time-out value :
set_data( 0xF1 , );
* If more help is needed, please contact Vecow Technical Support