|
I was following up on the shadow register guide and video here: http://www.cypress.com/?rID=2900
I downloaded the project files and had a look at the sample code for the shadow registers, it seems a bit much for a sample code for all i want my code to do,
I followed the video as much as I could understand, I set up a shadow register on port 1 and from the psocconfig.asm file in the source folder I see its called Port_1_Data_Shade
I set up a small program that has P1.1 as a constant output, P1.1 as an output to drive and LED for example, and P1.0 as the input which when high will activate the LED on port 1.2.
void main(void)
{
Port_1_Data_Shade |= 0x04;
PRT1DR = Port_1_Data_SHADE; // not sure if this required as this should always be high
while(1)
{
if (PRT1DR & 0X01)
{
Port_1_Data_Shade |= 0x02;
PRT1DR = Port_1_Data_Shade;
}
else
{
Port_1_Data_SHADE &= ~0x02;
PRT1DR = Port_1_Data_SHADE;
}
This seems to work ok,
Any pointers?
thanks guys
|