Shop OBEX P1 Docs P2 Docs Learn Events
What am i doing wrong? — Parallax Forums

What am i doing wrong?

worthyamherstworthyamherst Posts: 46
edited 2011-07-21 13:36 in Propeller 1
So im currently trying to problem shoot my transmitting/receiving codes by hardwiring the stamp to propeller board. And im running my program and getting a consistent 96 on the receiver side but it's not the data im sending :blank:
also in the hard wiring im using a 2.2k resistor for the voltage conversion
try it for your self

Propeller code:
CON
'ClkFreq: 80 Mhz
_XINFREQ = 5_000_000 'Adjust the frequency 
_CLKMODE = XTAL1 + PLL16X 'Adjust the frequency
rx = 7
tx = 2
baudRate = 9600
polarity = 1
bits = 8
OBJ
bs : "BS2_Functions" 'Basic Stamp 2 library
VAR
byte number 
PUB start
BS.start(31, 30)
repeat
  number := BS.serin_char(rx, baudRate, polarity, bits) 'receive from BS; Tried to use "BS.serin_dec", but didn't work
  BS.serout_dec(30, number, baudRate, 1, 8) 'show data received on screen
  BS.Debug_char(13)

BS Code:
'{$STAMP BS2}
'{$PBASIC 2.5}
x VAR Word
y VAR Word
DO
PULSOUT 8, 1200 'Sync pulse for the receiver
SEROUT 8, 16468, [ $AA, "!", x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE ]
x = x + 1
y = y + 1
DEBUG ? x
DEBUG ? y
PAUSE 1000
LOOP

Comments

Sign In or Register to comment.