Hello,I have a huge problem and I can't fix it for a days so I desided to ask you for help.My program is very simple but as you said before it's not imune for errors.I'm having this message: *** error 65: access violation at C:0xFF00 : no 'execute/read' permission. And this is my code:
#include <REG2051.H>
#define SL P1_4 #define SR P1_5
#define A P1_6 #define EN P1_7
unsigned char F = 0x00; unsigned char PF = 0;
void Go_To_Sleep (void) { PCON = 0x01; }
void main (void) { IT0 = 0; EX0 = 1; EA = 1; Go_To_Sleep (); } void Ext_Int (void) interrupt 0
{ F=~F; if(F==0x00) { A=0; } else { A=1; } while(PF==0) { EN=1; if(A==0) { if(SR==1) { PF=1; } } else { if(SL==1) { PF=1; } } } EN=0; PF=0; } Thank you!
Yes,I wanted to but it never happened. I salved the problem, instead of using the Go_To_Sleep function I put the PCON=0x01 into the while loop and it's working good.At least I think so.
void main (void) { IT0 = 0; // Configure interrupt 0 for rising edge on /INT0 (P3.2) EX0 = 1; // Enable EX0 Interrupt EA = 1; // Enable Global Interrupt Flag while(1) { PCON=0x01; } }