PDA

View Full Version : Classic



Haggar
- 17th April 2005, 19:27
well my program compiled smoothly but it didnt work as I expected.. here it is .. "btw iam a newbie .. and this is my first atempt to use the thing" ..

#################################################
Define loader_used 1
include "modedefs.bas" 'include serout defines
clear

init:
TRISB=%00000000 'all ports B output
TRISA=%11111111 'all ports A input
TXEN var PORTB.0
PWRUP var PORTB.1
TXP var PORTB.2
RXP var PORTA.0 <--- here is the pin where I recieve the serial data from
LED var portb.3

EYEMOD1 var Byte
RXDATA var byte
TXDATA VAR BYTE
CHILD1 var byte

num var Byte
PORTB=%00000000
EYEMOD1=%10110100
CHILD1=%00000011
RXDATA=%00000000

main:

Receive:

High PWRUP

LOW TXEN

Pause 3

Serin RXP,T9600,1000,Standby,["A"],RXDATA <<--- iam suspecting this

if RXDATA=EYEMOD1 then

goto transmit
else

LOw PWRUP

PAUSE 2000

goto Receive

endif


Standby:
Low TXEN
Low PWRUP
Low led
pause 5000
goto Receive

Transmit:
High PWRUP
HIGH TXEN
pause 3
TXDATA=RXDATA | CHILD1
Serout TXP,T9600, ["A",TXDATA]

PAUSE 1000
goto Standby

END
################################################## ##

mister_e
- 17th April 2005, 19:52
Could thousands things here

BUT...

what about your pic #. More than often, there's analog pins on PORTA (ADC or Comparator). If so, you must disable, at least, this/those lasts on your PIC Serial Data Input.

Haggar
- 18th April 2005, 09:57
PIC16F877 .. this is the one ..

I have two of them communicating with each other using serin/serout the out put of the sending chip was varified to be as "A" + 10110100 using the Oscilloscope.