Shop OBEX P1 Docs P2 Docs Learn Events
carriage return — Parallax Forums

carriage return

OwenOwen Posts: 100
edited 2007-01-18 21:08 in Propeller 1
Can anyone tell me how I can send a carriage return after a string using fullDuplexSerial or Extend_FDSerial?

Thanks,
Owen

Comments

  • bambinobambino Posts: 789
    edited 2007-01-18 13:30
    Look at the PC_Debug object. It should give you a starting point.

    You could also look up "CR" in the ascii chart and send out the Hexidecimal equivalent. Sorry, don't know where to find you one of the charts though. I have mine from the text book that comes with the EB500 bluetooth manuel. I think it's possibly $13, but I'm not sure!
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-01-18 13:33
    To send a carriage return:
    serial.tx(13)

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    StampPlot - Graphical Data Acquisition and Control
    AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-01-18 20:57
    Owen,

    if youare using the 'FullDuplexSerial' object i.e

    OBj
    ser:"FullDuplexSerial"


    ser.start(8, 7, 2, 9600) 'rxpin,txpin,mode,Baudrate
    ser.str(string("Test String",13))

    replace '13' with a '10' for line feed

    or for carriage return and line feed

    ser.start(8, 7, 2, 9600)
    ser.str(string("Test String",13,10))


    and if you just wanted to output an actual decimal number -

    ser.dec(123)

    note that you cannot add a CR in this line - so just follow that line with
    ser.str(string(13))
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-01-18 21:08
    Owen

    Having posted my first reply I remembered a recent incident here,
    It may save you and others some debug time ....


    Part2:

    One of the lads here in the workshop had a problem - his code was fine but was getting
    oddball characters at output - he had inadvertently changed the _xinfreq = 6_000_000

    when it should have been -

    CON
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000



    a quick check in the 'FullDuplexSerial' object explained it all -
    the following is Pub Start from 'FullDuplexSerial'
    PUB start(rxpin, txpin, mode, baudrate) : okay

    '' Start serial driver - starts a cog
    '' returns false if no cog available
    ''
    '' mode bit 0 = invert rx
    '' mode bit 1 = invert tx
    '' mode bit 2 = open-drain/source tx
    '' mode bit 3 = ignore tx echo on rx

    stop
    longfill(@rx_head, 0, 4)
    longmove(@rx_pin, @rxpin, 3)
    bit_ticks := clkfreq / baudrate
    buffer_ptr := @rx_buffer
    okay := cog := cognew(@entry, @rx_head) + 1


    note: the bit_ticks calculation ..............................

    not related to your problem - which I hope by now you have sorted (hope 1st reply helped)
    but worth noting all the same....
Sign In or Register to comment.