We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi everyone. I need your help to solve this issue. I am using a XC164CS microcontroller to run an aplication. The next aplication code toggles a P9.0 pin every 8 seconds.
#include <XC164.h> #define T2INT 0x22 #define GPT1_TIMER_2 2 sbit led = P9^0; void GPT1_vInit(void); void MAIN_vUnlockProtecReg(void); unsigned char second; void main (void) { MAIN_vUnlockProtecReg(); // unlock write security PLLCON = 0x7D54; // load PLL control register GPT1_vInit(); // initialize Timer 2 PSW_IEN = 1; DP9 = 0x0001; // load direction register while(1); } void GPT1_viTmr2(void) interrupt T2INT using RB_LEVEL15 { second++; if(second == 8) { second = 0; led =! led; } GPT12E_T2 = 0x8170; // load timer 2 register to interrupt every 1 sec }
When I declare unsigned char idata the "second" variable, the application works properly. (This variable is alocated in on chip ram). However if i just declare unsigned char (external memory) the appliction doesn't work. The pin doesn't toggle. I have off-chip SRAM connected through an 16 bit multiplexed bus. Below I show you some configuration and setup.
What could be the problem? Thank you very much.
subefotos.com/.../