Shop OBEX P1 Docs P2 Docs Learn Events
is bs2p capable of having a baud rate of 19200? — Parallax Forums

is bs2p capable of having a baud rate of 19200?

ice-egozice-egoz Posts: 55
edited 2004-09-08 13:28 in BASIC Stamp
My program requires a connection between the Bs2p and Nokia 7110(modem) of 19200bps. I know that it is equivalent to 16494(baudmode). But the debug terminal keeps showing 9600. My program works fine with another modem at the rate of 9600. but i need to use nokia, so any suggestion?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I need all ya guidance Masters. [noparse]:)[/noparse]

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-07 03:42
    Standard DEBUG output statements are at 9600 baud. If you're using SEROUT at 19.2 kB, you can manually open a DEBUG terminal, select the com port it's using, and then set the baud rate

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • ice-egozice-egoz Posts: 55
    edited 2004-09-07 04:07
    how do i do that? I did that in preferences but its not working. could u give me the steps to do that?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I need all ya guidance Masters. [noparse]:)[/noparse]
  • ice-egozice-egoz Posts: 55
    edited 2004-09-07 04:32
    how wud i have to convert my file it if the baud is the onli one changed? one w/ 9600 baud works. when changed the baud and the modem, it doesnt work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I need all ya guidance Masters. [noparse]:)[/noparse]
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-07 12:01
    The easiest way to make global changes in a program is to uses a named constant -- this is much better than embedding the actual baudrate values in your program code.· For example, I have this section in all my programs:

    #SELECT $STAMP 
      #CASE BS2, BS2E, BS2PE 
        T1200 CON 813 
        T2400 CON 396 
        T4800 CON 188 
        T9600 CON 84 
        T19K2 CON 32 
        T38K4 CON 6 
      #CASE BS2SX, BS2P 
        T1200 CON 2063 
        T2400 CON 1021 
        T4800 CON 500 
        T9600 CON 240 
        T19K2 CON 110 
        T38K4 CON 45 
    #ENDSELECT 
    
    Inverted  CON $4000 
    Open      CON $8000 
    
    Baud      CON T19K2 | Inverted
    

    By using this conditional compilation block I can change SEROUT/SERIN·baud rates easily and I don't have to think about which BASIC Stamp I'm using because the program handles that too.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-07 12:03
    You can manually open a DEBUG window by clicking on the "New Debug" icon on the toolbard (next to the Run button).· When you open it, you have to select the comm port it's connected to, then you can select the baud rate.·
    ice-egoz said...
    how do i do that? I did that in preferences but its not working. could u give me the steps to do that?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • ice-egozice-egoz Posts: 55
    edited 2004-09-08 01:32
    I did that. so i press ctrl-r? if i did that, there'll be weird letterings which i wont understand.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I need all ya guidance Masters. [noparse]:)[/noparse]
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-08 02:46
    Do you have the correct SEROUT settings? You need to use Inverted mode to use the programming port on the BASIC Stamp because it has interter circuitry.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • ice-egozice-egoz Posts: 55
    edited 2004-09-08 03:26
    Yes, I have the correct serout settings. It is inverted.
    By the way what does "Data occupies same location as program"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I need all ya guidance Masters. [noparse]:)[/noparse]
  • ionion Posts: 101
    edited 2004-09-08 04:19
    ice-egoz,

    In response to your question,"Data occupies same location as program", unfortunatly is only one sad answer.

    Your data stored in the eeprom is overlapped by the program. I did have the same problem too. Maybe you have too many data statements on your program, or the program grow so big that it needs more space and it will try to write on the locations which you assigned as data statements. The solution is to check your code and make it more eficient and smaller , or to move all the data statements to a diferent bank. On my programs i have usualy bank 6 defined as LCD_Data. All the statements on the eeprom i store them there. It is a big place and if you put them well you have a lot of room to store. To retrive them i just use store command before reading or writing . See below a subroutine which i use (dumy code of course) :

    if value· < 10 then

    eeaddr=100································· 'address on bank 3 wher i store messages to display on LCD

    gosub show································· ' go and display a message

    endif

    if value >= 10 then

    eeaddr=100································ 'address on bank 4 where i store messages to print on the printer

    gosub print

    endif



    SHOW:
    STORE 3······································ 'THIS WILL REDIRECT TO READ FROM SLOT 3
    DO
    · READ EEADDR, eeData
    · SEROUT lcdpin,lcdbaud,[noparse][[/noparse]eedata]
    · eeaddr=eeaddr+1
    · IF (eedata =0) THEN EXIT
    LOOP
    STORE 0····································· ' This will return the control to slot 0
    RETURN

    PRINT:
    STORE 4····································· 'this i read the messages to print from slot 4
    DO
    · READ EEADDR, eeData
    ·SEROUT prnpin, prnbaud,[noparse][[/noparse]EEDATA]
    ·eeaddr=eeaddr+1
    · IF (eedata = 0) THEN EXIT
    LOOP
    STORE 0···································· ' here i return the control to slot 0
    RETURN

    I hope that will help you with the overlapping problem.

    To see where your program overlap, a temporary solution is to comment· " ' " all the data statements and look on the memory map. On the left you can see how big is the program and how much data you can use. Then, uncoment one data statement at the time and look at memory map to see where you are. At one point you will get back the message and you will now that you are at the limit of data and program

    Good luck

    Ion
  • ice-egozice-egoz Posts: 55
    edited 2004-09-08 04:46
    Thanks. Ill try to see if i can work it out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I need all ya guidance Masters. [noparse]:)[/noparse]
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-08 13:28
    It takes a bit of thought, but putting messages in an extra bank of a BS2p or BS2pe is a great way to save EE space in your main program block.· I usually decide on a maximum length for my messages, then I can use a message pointer and a bit of math to point to the starting location in the other block.· If, for example, I wanted messages up to 15 characters long (16 with zero termination), I could do this:

    Send_Msg: 
      eePntr = msgNum * 16 
      STORE MsgBlock 
      DO 
        READ eePntr, char 
        eePntr = eePntr + 1 
        IF (char = 0) THEN EXIT 
        DEBUG char 
      LOOP 
      RETURN
    


    In the message slot, I would define data statements like this:

    Msg0  DATA  @$00, "Jon", 0 
    Msg1  DATA  @$10, "Williams", 0 
    Msg2  DATA  @$20, "Parallax", 0 
    Msg3  DATA  @$30, "BOE-Bot", 0
    

    By using @$x0 in the DATA statments I can force the message locations to be on eve 16-byte boundaries.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
Sign In or Register to comment.