Shop OBEX P1 Docs P2 Docs Learn Events
how to receive unsigned long int value from RS232 and display it on VGA screen? — Parallax Forums

how to receive unsigned long int value from RS232 and display it on VGA screen?

kamengrinder666kamengrinder666 Posts: 8
edited 2011-06-19 01:50 in Propeller 1
i want to receive unsigned long int value from RS232 and display it on VGA Screen

i can receive unsigned long int from RS232 and display it on hyperterminal now

but i have no idea how to display that value on VGA screen

i use an object "VGA Text" now

but it doesn't work . it can display only integer value. anybody have any idea?




this is my first post , sorry for my english in advance

Comments

  • kwinnkwinn Posts: 8,697
    edited 2011-06-18 10:58
    If it was working with hyperterm then the long was being sent as ascii characters. There are 2 options. You can receive each character and put it on the screen using the "out" function of VGA Text until the entire long is displayed. The second option is to receive each character and store them in a string until they have all been received and then use the "str" function to output it.

    If you still have problems you should post the code you are using with your request.
  • StefanL38StefanL38 Posts: 2,292
    edited 2011-06-18 16:22
    Hi Kamen,

    welcome to the propeller-forum.

    The VGA_Text.spin file has a method "dec" which translates the 32bit-number of a long into a decimal digits.

    If your vga_text-object does not contain a dec-method please tell us from where you are using this object and attach your archived project to a psoting

    best regards

    Stefan
  • AribaAriba Posts: 2,690
    edited 2011-06-18 16:38
    ... it can display only integer value. anybody have any idea?
    Does this mean, you can display only a signed long?

    For Spin longs are all signed values, so with the .dec() methode you always get a signed number displayed.
    You can use the .hex(value,8) methode to get a hexadecimal form (which is unsigned) or a construct like that:
    vga.dec(value>>1 / 5)       '1/10 of unsigned value
      vga.dec((value&15)//10)     'add lowest digit
    
    for a decimal unsigned value.

    Andy
  • kamengrinder666kamengrinder666 Posts: 8
    edited 2011-06-18 23:13
    thank you for response !!! with your assistance , it's work now

    it's a very very unexpected simple code

    con
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000

    TXPIN = 0
    RXPIN = 1

    obj
    ser : "Extended_FDSerial"
    text : "vga_text"

    pub main | rss

    ser.start(RXPIN,TXPIN,0, 9600)
    text.start (16)

    rss := "e" ' an character that i transmitt to receiver
    ser.tx (rss)

    repeat
    text.out (ser.rx)





    i have another question .

    how to quit from repeat loop when all of value were received?

    thank you in advance!!!

    sorry for my english again.
  • StefanL38StefanL38 Posts: 2,292
    edited 2011-06-19 01:50
    Hi Kamen,

    here I would like to know what you want to do in the end.

    The best solution depends on that. So please give us (the forum-members) an overview about what is the purpose of receiving integervalues and displaying them on the screen.

    There is another driver FullDuplexSerialPlus. This object has methods to receive ASCII-codes numbers and translate them into integers.
    The basic technique to do this is to send a character that signals endof number which usually is ASCII-code decimal 13 (carriage return in short CR)

    keep the questions coming
    best regards

    Stefan
Sign In or Register to comment.