Shop OBEX P1 Docs P2 Docs Learn Events
How to display word value in sx/b? — Parallax Forums

How to display word value in sx/b?

verobelverobel Posts: 81
edited 2008-01-04 15:40 in General Discussion
·Fellow SXers; (happy new year)

·I would like to display a value from 0001 to 9999 on a 4 segment display using sx/b.
·This is what I have coded... but it only works for the 10's and 100's.. /1000 gives a compile·error
·How would I correct this code?

·'sensorCount·VAR ·Byte
·sensorCount·VAR ·Word
·SC0············ VAR···· Byte
·SC1············ VAR···· Byte
·SC2············ VAR···· Byte
·SC3············ VAR···· Byte

'· code to display sensorCount on 2nd 4 Dig LED
· 'SC3 = sensorCount / 1000
· SC2 = sensorCount / 100
· SC1 = sensorCount / 10
· SC0 = __REMAINDER
· 'SC3 = 1
· 'SC2 = 2
· 'SC1 = 3
· 'SC0 = 4
· READ SegMap + SC3, display(4)
· READ SegMap + SC2, display(5)
· READ SegMap + SC1, display(6)
· READ SegMap + SC0, display(7)

·Thanks, John

Comments

  • BeanBean Posts: 8,129
    edited 2008-01-04 15:40
    John,
    You cannot assign a bytevar the result of a wordvar operation.

    There are several "word to ascii" routines on the forum, to a search with search.parallax.com

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com

    ·
Sign In or Register to comment.