Shop OBEX P1 Docs P2 Docs Learn Events
Propeller cog lockup with BS2_Functions? — Parallax Forums

Propeller cog lockup with BS2_Functions?

AKruzelAKruzel Posts: 25
edited 2011-04-08 20:14 in Propeller 1
I’m having trouble sending wireless data, one ascii character at a time, from my propeller to the basic stamp using the 433MHz transceiver modules.

My propeller is using the BS2_Function file to send data with code shown below:

PUB Main

' start the serial terminal
BS2.start(31,30)
'serial.start(1,0,0,9600)
init1 := "!"
init2 := "a"
BS2.HIGH(1)



repeat
letter := BS2.DEBUGIN_CHAR
BS2.SEROUT_STR(tx,letter,baud,mode,bits)




I modified the SEROUT_STR command as shown below:

PUB SEROUT_STR(Pin, letter, Baud, Mode, bits)
{{
Sends a string for serout
BS2.Serout_Str(5,string("Spin-Up World!",13),9600,1,8)
BS2.Serout_Str(5,@myStr,9600,1,8)
Code adapted from "FullDuplexSerial"
}}

init1 := "!"
init2 := "a"

SEROUT_CHAR(Pin,init1,Baud,Mode,bits)
SEROUT_CHAR(Pin,init2,Baud,Mode,bits)
SEROUT_CHAR(Pin,letter,Baud,Mode,bits)


BASIC Stamp receives information with code shown below:

DO

LOW 11
DEBUG "BEFORE 1st SERIN"
SERIN 11, 16468, [WAIT("!a"),LCDCHAR]
DEBUG ASC? LCDCHAR
HIGH 11

LOOP



My goal is to type a letter in the propeller terminal window and have it appear in the basic stamp2 terminal window. This code lets the first letter I type go through OK but any other letter afterwards nothing happens. I believe this is a cog lockup because when I take out the DEBUGIN command in the propeller code and just set “letter” to be “A” for instance, the BASIC STAMP will receive the “A” over and over.

This is my first time posting so if there is anything i can do to make things clearer please let me know. Any help is appreciated!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-04-08 11:48
    You really need to attach your source file to a message so the whole thing is available. These incomplete fragments are not very helpful and the problem may well be in the portions you've not shown. DO NOT cut and paste anything larger than the tiniest fragment and, if you do use cut and paste, use the [ code ] [ /code ] brackets around it so the indenting is preserved.
  • AKruzelAKruzel Posts: 25
    edited 2011-04-08 13:12
    Apologies, attached is the code for the BS2 and prop.
  • AKruzelAKruzel Posts: 25
    edited 2011-04-08 13:34
    forgot my modified BS2_Functions code as well..apologies
  • AKruzelAKruzel Posts: 25
    edited 2011-04-08 16:10
    My code actually works perfect when i have a hard wire between the BS2 and the prop. I can type all the characters i want in the prop terminal window and they appear in the basic stamp terminal window. Only when i try to use the wireless transceivers does the BS2 only process the 1st character that is sent through and ignore the rest.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-04-08 18:21
    Part of your problem may be the way you handle the "sync" pulse. This is supposed to be a brief (2-3ms) pulse on the transmit data line shortly before the first character is sent. It mostly sets the automatic level control (ALC) in the receiver. Your code sets the data line high and it only gets set low when the start bit of the first character is transmitted. Try putting a 3ms delay after the HIGH call using PAUSE(3), then set the output pin low with a LOW call, then another brief delay, like PAUSE(1), before sending the 1st character.
  • AKruzelAKruzel Posts: 25
    edited 2011-04-08 20:14
    that did it! made assumptions when jumping from wired to wireless, was just learning to use the BS2_functions OBJECT and got too wrapped up in that. Thank you!
Sign In or Register to comment.