In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Castrovinci wrote: 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.... [url=jwilliams@parallax.com]jwilliams@parallax.com[/url] ' 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 [ 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 ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=105724 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)