hi all, I want to read uart receive values. my interrupt is working. But for example when ı send 0x02, ı should light a led. I should understand the value. Can u help me please? my codes;
#include "N76E003.h"#include "SFR_Macro.h"#include "Common.h"#include "Delay.h"#include "Function_define.h"
unsigned char c;bit riflag;void SerialPort0_ISR(void) interrupt 4 { if (RI==1) { clr_RI; c = SBUF; riflag =1;}}
void main (void){ P12_PushPull_Mode; P07_Quasi_Mode; InitialUART0_Timer1(9600); set_ES; set_EA;
while(1) { if (riflag) { P12 = ~P12; riflag = 0; } }}
Note that any variable modified in an ISR should be declared volatile.
merve said:when ı send 0x02, ı should light a led.
so test the received value to see if it is 0x02; if it is - light the LED.