I started to do some GSM controller project with the PIC, as a school project. But I constantly arises a problem that my pic "goes crazy". At end I think it's problem with the Interrupts. I had connected a LED on RB.0 that is a INT input, and when i set the RB.0, in the program, on 1 the PIC start to act crazy (LED's blink, and he send some partial informations trought the USART). I tried to not set RB.0 on 1 and everything works fine. So I tried to connect the LED on RB.4 (it's a INT input again) and the same problem occurs when i set it to 1. I tried to set the INTCON=0 (INTCON.3, INTCON.4=0) but the problem is still there.
Here is some example of the PBP code:
I hope someone can help me!Code:DEFINE OSC 8 DEFINE HSER_RCSTA 90h DEFINE HSER_TXSTA 20h DEFINE HSER_BAUD 9600 DEFINE HSER_SPBRG 12 CMCON = 7 INTCON=0 symbol LED1=PORTB.3 SYMBOL LED2=PORTB.4 SYMBOL SDA = porta.0 SYMBOL SCL = porta.1 DEFINE I2C_SDA PORTA.0 DEFINE I2C_SCL PORTA.1 adr VAR BYTE ZNAK VAR BYTE [5] OUTPUT LED2 OUTPUT LED1 adr=20 serial: hserout ["SERIAL"] hserin 3000, serial, [str ZNAK\5] pause 100 HIGH LED1 PAUSE 1000 LOW LED1 I2CWRITE SDA, SCL, $A0, adr, [STR ZNAK\5] PAUSE 10 HSERIN [WAIT ("OK")] GOSUB LDE PAUSE 500 HIGH LED2 PAUSE 2000 GOTO SERIAL LDE: HIGH LED2 HIGH LED1 PAUSE 1500 LOW LED2 PAUSE 1500 LOW LED1 HIGH LED2 PAUSE 1500 HIGH LED2 LOW LED1 PAUSE 1500 LOW LED2 RETURN END
P.S. Sorry for my beeeeeddd english!!!!
Bookmarks