EasyManua.ls Logo

VORAGO REB1 - Page 32

VORAGO REB1
35 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
VA10800/VA10820 Evaluation Board User’s Manual
V3.0
31
Second, the main routine (inside file reb_main.c) should be opened and some code added. If
not already open, please double click on the demonstration project,
../software/mcu/project/reb1_va108xx. Navigate to a section of the code around line 58 that
already sets up the port pin for driving LED2.
Since we are not using the GPIO_DRIVER library, the “else” section will be compiled. Modify
the lines that setup the direction, datamask and dataout registers to include PORTA6. It should
look something similar to:
VOR_GPIO->BANK[0].DIR |= (1 << PORTA_10_D2) | (1 << PORTA_6_D4);
VOR_GPIO->BANK[0].DATAMASK |= (1 << PORTA_10_D2) | (1 << PORTA_6_D4);
VOR_GPIO->BANK[0].DATAOUT &= ~((1 << PORTA_10_D2| (1 << PORTA_6_D4)));
Next we need to toggle the pin on 400 msec intervals. Navigate to code near line 120 in
reb_main.c. This is a subroutine that is entered every 100 msec. The time base is set by a timer
interrupt. We will need to count to 4 before toggling the port pin. A variable must be created
for this counting purpose. Place the following code at the top of the reb_main.c routine with
the other variable declarations:
uint8_t cnt_400msec = 0 ;
Now, please enter the following code in green to count to 4 and toggle the pin.
if( VOR_TIM0_MSecExpired() ) {
cnt_100msec ++ ;
if (cnt_100msec > 3)

Related product manuals