Quote Originally Posted by lerameur
just posted the unworking program ,
nothing is coming out of the sending chip

I know nothing is working on your sending chip...you've got it set up wrong. Read my words a couple of posts ago. Going out of the chip back into the chip isn't going to work.

Plug this into your sending chip, with only the LEDs and a button attached to portb.0 with a pulldown resistor:

-------------------------------------------------------------------------
INCLUDE "modedefs.bas"
DEFINE OSC 20 'use external 20mhz crystal
CMCON = 7 : ANSEL = 0 : ADCON1 = 7

ledcount var byte

led1 var porta.0 : output led1 'led on porta.0
led2 var porta.1 : output led2 'and so on...
led3 var porta.2 : output led3
led4 var porta.3 : output led4

key var portb.0 : input btn 'push button on portb.0
'1K-10K resistor from portb.0 to ground (pulldown)
'push button is wired between portb.0 and +5v

led1 = 1 : pause 500 : led1 = 0 'initial light up to see if program is running
led2 = 1 : pause 500 : led2 = 0
led3 = 1 : pause 500 : led3 = 0
led4 = 1 : pause 500 : led4 = 0

mainloop:

if key = 0 then 'button not pressed
goto mainloop
endif
if key = 1 then
pause 50 'wait 50ms for switch to debounce then check again
if key = 1 then 'if it's still pressed, then increment the count
ledcount = ledcount + 1
endif
endif

if ledcount = 0 then 'all leds off
led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
endif
if ledcount = 1 then '1st led on
led1 = 1 : led2 = 0 : led3 = 0 : led4 = 0
endif
if ledcount = 2 then '2nd led on and so on and so on down the line....
led1 = 0 : led2 = 1 : led3 = 0 : led4 = 0
endif
if ledcount = 3 then
led1 = 0 : led2 = 0 : led3 = 1 : led4 = 0
endif
if ledcount = 4 then
led1 = 0 : led2 = 0 : led3 = 0 : led4 = 1
endif
if ledcount = 5 then 'reset led count, roll it back to 0
ledcount = 0 'and turn leds off since count is back to 0
led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
endif

goto mainloop

END




Forget about serial code, the LCD and anything else that isn't listed above. Just do what's listed, and nothing else. If you go off on a tangent somewhere else, I don't know where you're going. Just do this. Get this to work. Then do the same basic thing on the receiver PIC. Get them both to work. We'll worry about connecting the 2 after both of these work.
All this program is going to do is make the LED lights walk about 5 times a second as long as you hold the button down.
JDG