Shop OBEX P1 Docs P2 Docs Learn Events
SXKey IDE newline — Parallax Forums

SXKey IDE newline

_djm_djm Posts: 12
edited 2006-03-05 22:09 in General Discussion
I have a tool that outputs some data as characters for use on an SX chip. It's in the format


dw $00, $0F, $00, $00, $00, $FF, $B0, $00, $00, $0F, $B0, $00, $00, $0F, $B0

dw $00, $00, $0F, $B0, $00, $00, $0F, $B0, $00, $00, $0F, $B0, $00, $00, $00

For a newline I use '\n'

If I open this data file and cut/paste this selection into the SX IDE, I get a square symbol where each newline should be. This can be pretty time consuming to remove all these and insert newlines.

Are there any settings I can change in the IDE or should I be outputting something different than the '\n' ?



Comments

  • John CoutureJohn Couture Posts: 370
    edited 2006-03-05 21:48
    Do you mean the hex equivalent of $0D or $0A? (Carriage Return, Line Feed)

    Edit:

    Oops, it just dawned on me the problem.· If you open the file in NotePad it will give you that square box.· If on the other hand you open it in WordPad, it will look normal.· Saving it in Wordpad will append the carriage return.

    Maybe to make it clearer:

    Notepad is very literal as are many editors.· They expect a CR / LF at the end of each line because that was the old protocol used with teletypes, etc.· Wordpad will accept it either way but it will fix it when you save the file.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College

    Post Edited (john couture) : 3/5/2006 9:52:05 PM GMT
  • _djm_djm Posts: 12
    edited 2006-03-05 22:01
    Thanks, that works fine if I open it in wordpad and cut it from there.

    Just out of curiosity, what would I need to save out in my file for a newline (CR) to be recognised in all editors ?
  • John CoutureJohn Couture Posts: 370
    edited 2006-03-05 22:09
    right now you are outputting $0F which the equivalent of '\n'·

    If you were to ALSO output a $0D before the $0F, that should solve the problem.

    I'm lazy so I use Jon Williams TX_Out routine (see below) and then I create a subroutine like:

    TX_CRLF:
    ' Use: TX_CRLF
    ' -- transmits a carriage return and line feed to output device
    '
    ·· TX_Out $0D
    ·· TX_Out $0A
    ·· RETURN

    TX_OUT:
    ' Use: TX_OUT
    ' -- this routine is used by most other routines because it
    '··· allows you to send a single character or an entire
    '··· zero terminated string.·Jon Williams Special!
    '
    · TX_temp3 = __PARAM1····················· ' get byte or string offset
    · IF __PARAMCNT = 2 THEN
    ··· TX_temp4 = __PARAM2··················· ' get string base
    ··· DO
    ····· READ TX_temp4 + TX_temp3, TX_temp5·· ' read a character
    ····· IF TX_temp5 = 0 THEN EXIT··········· ' if 0, string complete
    ····· TX_BYTE TX_temp5···················· ' send the byte
    ····· INC TX_temp3························ ' point to next character
    ····· TX_temp4 = TX_temp4 + Z············· ' update base on overflow
    ··· LOOP
    · ELSE
    ··· TX_BYTE TX_temp3······················ 'transmit the byte value
    · ENDIF
    · RETURN

    TX_BYTE:
    ' Use: TX_BYTE aByte
    ' -- transmits one byte to an LCD, Serial or RS-485 device
    '
    ·· TX_char· = __PARAM1
    ·· SEROUT SIO,BAUD,TX_Char ' send byte to RS485 network
    ·· RETURN




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College
Sign In or Register to comment.