This is my code and my problem explained. I cannot store a byte into a variable:
What am I missing? please help.Code:'-----------------------CONFIGURATION---------------------- DEFINE OSC 20 Include "modedefs.bas" #CONFIG ifdef PM_USED device pic16F877A, xt_osc, wdt_on, lvp_off, protect_off else __Config _HS_OSC & _WRT_256 &_WDT_OFF &_PWRTE_ON &_BODEN_ON & _LVP_OFF & _CP_ALL &_CPD_ON endif #ENDCONFIG @ ERRORLEVEL -306 DEFINE DEBUG_REG PORTC DEFINE DEBUG_BIT 6 DEFINE DEBUG_BAUD 9600 DEFINE DEBUG_MODE 1 DEFINE DEBUGIN_REG PORTC DEFINE DEBUGIN_BIT 7 DEFINE DEBUGIN_MODE 0 '--------------------REGISTERS------------------------------- PAUSE 100 ADCON1=7 CMCON=7 OPTION_REG=%10000111 TRISA=0 : PORTA=0 TRISB=0 : PORTB=0 TRISC=%10000000 : PORTC=0 TRISD=0 : PORTD=0 TRISE=0 : PORTE=0 CCP1CON=0 '---------------------------------------------------------------------- LED Var PortD.1 B0 Var byte '--------------------The below does not work i.e. LED does not toggle-------------- Main: b0=0 Debugin [b0] ' Tried STR B0\1 as well but no luck if b0="1" then GoSub TOG Pause 200 Goto Main '--------------------Change the Above with the following : The below works i.e. LED does toggle-------------- Main: Debugin [WAIT ("1")] ' I tried many inputs but only when I send 1 it works. So it does realises 1 somehow GoSub TOG Pause 200 Goto Main Tog: Toggle PortD.1 Return





Bookmarks