serial out sx48 problem
Castrovinci
Posts: 26
Hello bean and john and users,
· Once again need your help.· I used this program you sent me (modified to this) and it works to what I need on the sx28 chip.· I purchased an sx48 proto board, and now it will only continuisly (I cant spell) send ******** or weird characters.· If I try to send the character (A) just to test it it works, but if i use $65 it is an *.· I tried every both external X2 that come with the sx tech kit and still just sends wierd characters.· I tried several different baud rates same thing.· What do you think is going on.· Its weird because sx18, sx28 the program does what I need.· I have two seperate proto boards so I know both arent bad.· I also moved around pin locations?
Thank you so much
Tony Castrovinci
P.S. I tried N9600 and t9600 N only works
' =========================================================================
''''''''''',TURBO, STACKX, OPTIONX
'·· File...... PINS-OUT.SXB
'·· Purpose...·
'·· Author.... Jon Williams, Parallax
'·· E-mail.... jwilliams@parallax.com
'·· Started...
'·· Updated... 13 JAN 2006
'
' =========================================================================
'
' Program Description
'
'
' Device Settings
'
DEVICE········· SX48, OSCxt2
FREQ··········· 4_000_000
CrLf:
·
DATA·13, 10, 0
'
'
' IO Pins
'
Sout··VAR·Ra.0
InPin1··VAR·Rc.7
InPin2··VAR·RA.1
InPin3··VAR·RA.2
InPin4··VAR·RA.3
SDATA·········· VAR···· BYTE
'
' Constants
'
Baud··CON·"n9600"
'
' Variables
'
inBits··VAR·Byte
temp1··VAR·Byte···' subroutine work vars
temp2··VAR·Byte
temp3··VAR·Byte
temp4··VAR·Byte
temp5··VAR·Byte
' =========================================================================
· PROGRAM Start
' =========================================================================
'
' Subroutine Declarations
'
GET_INPUTS·SUB
TX_BYTE··SUB·1, 2
TX_STR··SUB·2
TX_BIN4··SUB·1
WAIT_MS··SUB·1, 2
'ANTHONY········ SUB···· 1
'
' Program Code
'
Start:
· plp_A = %10000001
· PLP_B = %00000000····' pull-up unused pins
· PLP_C = %00000000·
Main:
· DO
·· inBits = GET_INPUTS
··· pause 100
··· TX_BIN4 inBits····' send to screen
··· TX_STR CrLf
··· ····' add CR + LF
··· WAIT_MS 50, 4
·······
·LOOP
'
' Subroutine Code
'
' Use: value = GET_INPUTS
' -- scans input pins and returns in "value"
GET_INPUTS:
· temp1 = 0
· temp1.0 = InPin1
· temp1.1 = InPin2
· temp1.2 = InPin3
· temp1.3 = InPin4
· RETURN temp1
'
' Use: TX_BYTE theChar {, repeats}
' -- transmits "theChar", "repeats" times
TX_BYTE:
· temp1 = __PARAM1····' get character
· IF __PARAMCNT = 1 THEN···' repeats sent?
··· temp2 = 1·····' no, send once
· ELSE
··· temp2 = __PARAM2····' yes, send x repeats
· ENDIF
· DO WHILE temp2 > 0
··· SEROUT Sout, Baud, temp1···' send the character
··· DEC temp2·····' update tx count
· LOOP
· RETURN
'
' Use: TX_STR [noparse][[/noparse] string | label ]
' -- "string" is an embedded literal string
' -- "label" is DATA statement label for stored z-String
TX_STR:
· temp3 = __PARAM1····························· ' get string offset
· temp4 = __PARAM2····························· ' get string base
· DO
··· READ temp4 + temp3, temp5·················· ' read a character
··· IF temp5 = 0 THEN EXIT····················· ' if 0, string complete
··· TX_BYTE temp5··················· ··' send the byte
··· INC temp3·································· ' point to next character
··· temp4 = temp4 + Z·························· ' update base on overflow
· LOOP
· RETURN
'
' Use: TX_BIN4 value
' -- sends "value" in BIN4 format
TX_BIN4:
· temp3 = __PARAM1····' save the value
· FOR temp4 = 1 TO 4····' loop through four bits
··· temp5 = temp3.3 + "0"···' convert bit to ASCII
··· TX_BYTE temp5····' send it
··· temp3 = temp3 << 1····' shift next bit to MSB
· NEXT
· RETURN
'
' Use: WAIT_MS milliseconds {, multiplier}
' -- multiplier is optional
WAIT_MS:
· temp1 = __PARAM1····························· ' get milliseconds
· IF __PARAMCNT = 1 THEN······················· ' if no multiplier
··· temp2 = 1·································· '·· set to 1
· ELSE········································· ' else
··· temp2 = __PARAM2··························· '·· get multiplier
· ENDIF
· IF temp1 > 0 THEN···························· ' no delay if either 0
··· IF temp2 > 0 THEN
····· PAUSE temp1 * temp2······················ ' do the delay
··· ENDIF
· ENDIF
· RETURN
·
onone:
·low rb.0
·goto main
offone:
·high rb.0
·goto main
' =========================================================================
' User Data
' =========================================================================
'CrLf:
·' DATA·13, 10, 0
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· Once again need your help.· I used this program you sent me (modified to this) and it works to what I need on the sx28 chip.· I purchased an sx48 proto board, and now it will only continuisly (I cant spell) send ******** or weird characters.· If I try to send the character (A) just to test it it works, but if i use $65 it is an *.· I tried every both external X2 that come with the sx tech kit and still just sends wierd characters.· I tried several different baud rates same thing.· What do you think is going on.· Its weird because sx18, sx28 the program does what I need.· I have two seperate proto boards so I know both arent bad.· I also moved around pin locations?
Thank you so much
Tony Castrovinci
P.S. I tried N9600 and t9600 N only works
' =========================================================================
''''''''''',TURBO, STACKX, OPTIONX
'·· File...... PINS-OUT.SXB
'·· Purpose...·
'·· Author.... Jon Williams, Parallax
'·· E-mail.... jwilliams@parallax.com
'·· Started...
'·· Updated... 13 JAN 2006
'
' =========================================================================
'
' Program Description
'
'
' Device Settings
'
DEVICE········· SX48, OSCxt2
FREQ··········· 4_000_000
CrLf:
·
DATA·13, 10, 0
'
'
' IO Pins
'
Sout··VAR·Ra.0
InPin1··VAR·Rc.7
InPin2··VAR·RA.1
InPin3··VAR·RA.2
InPin4··VAR·RA.3
SDATA·········· VAR···· BYTE
'
' Constants
'
Baud··CON·"n9600"
'
' Variables
'
inBits··VAR·Byte
temp1··VAR·Byte···' subroutine work vars
temp2··VAR·Byte
temp3··VAR·Byte
temp4··VAR·Byte
temp5··VAR·Byte
' =========================================================================
· PROGRAM Start
' =========================================================================
'
' Subroutine Declarations
'
GET_INPUTS·SUB
TX_BYTE··SUB·1, 2
TX_STR··SUB·2
TX_BIN4··SUB·1
WAIT_MS··SUB·1, 2
'ANTHONY········ SUB···· 1
'
' Program Code
'
Start:
· plp_A = %10000001
· PLP_B = %00000000····' pull-up unused pins
· PLP_C = %00000000·
Main:
· DO
·· inBits = GET_INPUTS
··· pause 100
··· TX_BIN4 inBits····' send to screen
··· TX_STR CrLf
··· ····' add CR + LF
··· WAIT_MS 50, 4
·······
·LOOP
'
' Subroutine Code
'
' Use: value = GET_INPUTS
' -- scans input pins and returns in "value"
GET_INPUTS:
· temp1 = 0
· temp1.0 = InPin1
· temp1.1 = InPin2
· temp1.2 = InPin3
· temp1.3 = InPin4
· RETURN temp1
'
' Use: TX_BYTE theChar {, repeats}
' -- transmits "theChar", "repeats" times
TX_BYTE:
· temp1 = __PARAM1····' get character
· IF __PARAMCNT = 1 THEN···' repeats sent?
··· temp2 = 1·····' no, send once
· ELSE
··· temp2 = __PARAM2····' yes, send x repeats
· ENDIF
· DO WHILE temp2 > 0
··· SEROUT Sout, Baud, temp1···' send the character
··· DEC temp2·····' update tx count
· LOOP
· RETURN
'
' Use: TX_STR [noparse][[/noparse] string | label ]
' -- "string" is an embedded literal string
' -- "label" is DATA statement label for stored z-String
TX_STR:
· temp3 = __PARAM1····························· ' get string offset
· temp4 = __PARAM2····························· ' get string base
· DO
··· READ temp4 + temp3, temp5·················· ' read a character
··· IF temp5 = 0 THEN EXIT····················· ' if 0, string complete
··· TX_BYTE temp5··················· ··' send the byte
··· INC temp3·································· ' point to next character
··· temp4 = temp4 + Z·························· ' update base on overflow
· LOOP
· RETURN
'
' Use: TX_BIN4 value
' -- sends "value" in BIN4 format
TX_BIN4:
· temp3 = __PARAM1····' save the value
· FOR temp4 = 1 TO 4····' loop through four bits
··· temp5 = temp3.3 + "0"···' convert bit to ASCII
··· TX_BYTE temp5····' send it
··· temp3 = temp3 << 1····' shift next bit to MSB
· NEXT
· RETURN
'
' Use: WAIT_MS milliseconds {, multiplier}
' -- multiplier is optional
WAIT_MS:
· temp1 = __PARAM1····························· ' get milliseconds
· IF __PARAMCNT = 1 THEN······················· ' if no multiplier
··· temp2 = 1·································· '·· set to 1
· ELSE········································· ' else
··· temp2 = __PARAM2··························· '·· get multiplier
· ENDIF
· IF temp1 > 0 THEN···························· ' no delay if either 0
··· IF temp2 > 0 THEN
····· PAUSE temp1 * temp2······················ ' do the delay
··· ENDIF
· ENDIF
· RETURN
·
onone:
·low rb.0
·goto main
offone:
·high rb.0
·goto main
' =========================================================================
' User Data
' =========================================================================
'CrLf:
·' DATA·13, 10, 0
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Comments
I will send this (i forgot to mention) ********1************************************************************
Sometimes.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Pull-ups are for inputs not outputs. $65 = "e"; 65= "A". But as for the problem, I'm with Jon, probably something with the connection to the PC. I not sure why the SX28 would work and the SX48 wouldn't though.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
"Ability may get you to the top, but it takes character to keep you there."
·
· I am using just a standard serial cable and wires.· I know you should use the max232 but I didnt for the sx28 and sx18.· Plus it does send letters ets just the program will just not work.· I have the ocs connected to the x2 section and I am·not using any external clock.· Did I need to?· How should my hardware connection be.· Any other suggestions?
Thanks so much,
Tony Castrovinci
You definitely need an external osc for serial comms; the internal oscillator is just not stable enough.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax