Listing 10-3. Drive a Flag Pin High
/*Example to show driving state of Flag 2 pin high when*/ */set
as an output*/
xr0 = SQCTL;;
xr0 = bset r0 by SQCTL_FLAG2_OUT_P;;
high (bit 26)*/
SQCTL = xr0;;
The next example combines the two previous examples with some minor
alterations to the code and shows how the
be an output pin instead of simply setting it. This programming change
enables you to continuously toggle a programmable flag pin connected to
a LED on the ADSP-TS101 EZ-KIT Lite.
Listing 10-4. Toggle a Pin
/*Example to show toggling of Flag 2 pin when set as an output*/
xr0 = SQCTL;;
xr0 = bset r0 by SQCTL_FLAG2_EN_P;;
(bit 22)*/
SQCTL = xr0;;
reset_counter:
counter 0*/
wait:
if NLC0E, jump wait;;
expired, wait here*/
xr0 = SQCTL;;
xr0 = btgl r0 by SQCTL_FLAG2_OUT_P;;
Flag 2 pin (bit 26)*/
SQCTL = xr0;;
jump reset_counter;;/* Repeat entire process*/
The following sample code shows how to set up a high priority
interrupt. The interrupt service routine contains a flag toggle routine that
toggles a programmable flag pin connected to a LED on the ADSP-TS101
ADSP-TS101 TigerSHARC Processor
Hardware Reference
*/ Read the Sequence Control Register*/
*/Write back to Sequence Control Register*/
/*Read the Sequence Control Register*/
/* Write back to Sequence Control Register*/
LC0 = 0x03B9AC9D;;
/*Read the Sequence Control Register*/
/* Write back to Sequence Control Register*/
System Design
*/ Drive Flag 2 pin
pin is toggled when set to
FLAG2
/*Set Flag 2 as output
/*Write value to loop
/*If loop counter 0 not
/*Toggle the value of
Timer0
10-13
Need help?
Do you have a question about the ADSP-TS101 TigerSHARC and is the answer not in the manual?