DEC to ASCII not working in HSEROUT


Closed Thread
Results 1 to 4 of 4
  1. #1
    SunDanzer's Avatar
    SunDanzer Guest

    Exclamation DEC to ASCII not working in HSEROUT

    I'm using an 18F4520 (i think) writing to an Orbital Matrix display over a serial port.

    I can write characters fine, but the variable RPM displays 00000. RPM is declared as a WORD. I've tried a lot of variations, RPM as a Byte, IDec, SDec, Dec, Dec1, Dec2, etc, #RPM, but only 00000. Also the Shift command is not working. This may be a clue.

    RPM = 100 ; RPM is a WORD
    HSEROUT [$FE,$47,0,2,"RPM = ", DEC5 RPM]

    Result >> RPM = 00000

    I think the DEC is not converting the number to ASCII correctly. I also have a fair number of variables, maybe 100, and a few hundred lines of assembly in an include file to create timers and a software PWM.

    These commands worked fine writing to an LCD using a parallel interface and the LCDOUT command. But since then, I expanded the assembly include file and added a few more variable.

    Any ideas?

    David B.

  2. #2
    Join Date
    Aug 2007
    Posts
    4


    Did you find this post helpful? Yes | No

    Cool I think I have the same DEC5 problem

    Hello,
    On Friday I was having a similar problem with the DEC5 and HSEROUT but I am not sure if is this "bug" or if my ADC was dead. Tomorrow I will check at work.

    Now I tested in a 18F4680 at home:

    Walue = 100 'also defined as word
    HSEROUT [DEC5 Walue,10,13]

    and the terminal shows "100" as expected, using PBPro, compling with MPLAB, so it seems to work fine.

    By the way, aren't you mixing up the LCD commands with the HSEROUT?
    $FE etc.. is used in the LCDOUT command, that has a different sintax than HSEROUT.

    JM

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jmontse View Post
    By the way, aren't you mixing up the LCD commands with the HSEROUT?
    $FE etc.. is used in the LCDOUT command, that has a different sintax than HSEROUT.

    JM
    Hello JM, The $FE is probably a serial LCD command as is the $47 giving instruction to it as to where to place the "string" data, as opposed to being HSEROUT formatting.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Jul 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Found the problem, has to do with configuration bits.

    Although the extended instruction configuration bit is disabled by default, if this line is used to turn LVP off,

    @ __CONFIG _CONFIG4L, _LVP_OFF_4L

    the extended instruction bit will be set. So it has to be specifically turned off with this

    @ __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L

    or else there is very strange and inconsistent behavior. Problems were experienced with the DEC modifier in HSEROUT and with the shift (<<) commands.

    Oddly, if the line

    @ __CONFIG _CONFIG4L, _LVP_OFF_4L

    is not used at all, the extended instruction bit remains disabled, as it should be by default.

Similar Threads

  1. I2C Slave with a PIC
    By ralfmayr in forum mel PIC BASIC Pro
    Replies: 129
    Last Post: - 21st August 2016, 17:44
  2. HSEROUT and Commas, What? Help Me Understand
    By altech6983 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th July 2009, 19:12
  3. Is HSEROUT corrupting bit 7 ?????
    By Robert Wells in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd October 2008, 16:26
  4. HSEROUT not working @ 40 MHz
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 14th September 2005, 17:44
  5. code problems
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th June 2005, 15:45

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts