How to display word value in sx/b?
·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
·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
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
·