32 bit data displaying on LCD


Closed Thread
Results 1 to 11 of 11
  1. #1
    selahattin's Avatar
    selahattin Guest

    Unhappy 32 bit data displaying on LCD

    Dear developers

    I 'm developing an operating panel (LCD and keypad included)
    for Matsushita PLCs.

    I have to display decimal 32 bit full range data (up to 4.294.967.295) on LCD and handle 32 bit data from LCD entered by the user.

    Displaying and retrieving LCD is no problem.

    But How can I display 32 bit decimal data to LCD and calculate new 32 bit data from LCD

    Thank you for your help right now

    Selahattin Aslan
    ASM Electronics Ltd

  2. #2
    rlampus's Avatar
    rlampus Guest


    Did you find this post helpful? Yes | No

    Default I also kneed to know.

    Dear developers

    I 'm developing an operating panel (LCD and keypad included)
    for Teksco USA.

    I have to display decimal 32 bit full range data (up to 4.294.967.295) on LCD and handle 32 bit data from LCD entered by the user.

    Displaying and retrieving LCD is no problem.

    But How can I display 32 bit decimal data to LCD and calculate new 32 bit data from LCD

    Thank you for your help right now

    Randy Lumpus
    Teksco,USA

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Duh... what i don't understand here...
    Quote Originally Posted by rlampus
    Displaying and retrieving LCD is no problem.

    But How can I display 32 bit decimal data to LCD and calculate new 32 bit data from LCD
    More about the calculation?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    blainecf's Avatar
    blainecf Guest


    Did you find this post helpful? Yes | No

    Default how do i count to 20 without taking my shoes off?

    When I take my shoes off, I can see my toes, so I can count to 20.

    When I count to 5, I only need to see one hand, but to 10, I need to see both hands.

    Therefore, if a word variable is 16 bits, two word variables is 32 bits. That means, if I declare a 2 element word array, I'll have 32 bits. So I'd just need a simple algorithm to refer to the array and treat it like one 32bit variable.

    You could use assembler, or use any of the bit functions (>> << or var.bit) to handle it.

    bcf

  5. #5
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by blainecf
    When I take my shoes off, I can see my toes, so I can count to 20.

    When I count to 5, I only need to see one hand, but to 10, I need to see both hands....

    bcf

    Hi blainecf,

    I wonder what would you take off if you needed to count to 40?
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  6. #6
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sayzer
    Hi blainecf,

    I wonder what would you take off if you needed to count to 40?
    LOL

    I'm still confused how you get beyond 23
    Keith

    www.diyha.co.uk
    www.kat5.tv

  7. #7
    rlampus's Avatar
    rlampus Guest


    Did you find this post helpful? Yes | No

    Default Could you give an example?

    Quote Originally Posted by blainecf
    When I take my shoes off, I can see my toes, so I can count to 20.

    When I count to 5, I only need to see one hand, but to 10, I need to see both hands.

    Therefore, if a word variable is 16 bits, two word variables is 32 bits. That means, if I declare a 2 element word array, I'll have 32 bits. So I'd just need a simple algorithm to refer to the array and treat it like one 32bit variable.

    You could use assembler, or use any of the bit functions (>> << or var.bit) to handle it.

    bcf
    This is very helpful, Thankyou. Could you please give one example of actual pic basic code.

    r lampus

  8. #8
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by rlampus
    Could you please give one example of actual pic basic code.
    As I have said in the past, there has got to be an easier way....but this might get your ball rolling. I worked it assuming you have no WORD variables and only BYTES. (i.e., I assumed you had a 16 bit number composed of two 8 bit variables instead of your 32 bit number composed of two 16 bit words. Expanding the below to DOUBLE WORDS is similar, just a lot more lines.) (Yes, I know we have WORDS in PBP – I am just demonstrating a process). -THIS IS UNTRIED IN ACTUAL CODE BUT WORKS ON PAPER-

    Background
    bit 1 = 1
    bit 2 = 2
    bit 3 = 4
    bit 4 = 8
    bit 5 = 16
    bit 6 = 32
    bit 7 = 64
    bit 8 = 128
    ----------------
    bit 9 = 256
    bit 10 = 512
    bit 11 = 1024
    bit 12 = 2048
    bit 13 = 4096
    bit 14 = 8192
    bit 15 = 16384
    bit 16 = 32768

    Code:
    ' Example: Dig 12345 (assuming WORDS not available)
    HiByte VAR BYTE
    LoByte VAR BYTE
    Digit VAR byte[5]
    HiByte = $30	' high byte of 12345 ($30 = 00110000)
    LoByte = $39 ' low byte of 12345
    
    Digit[0] = LoByte Dig 0	' = 7
    Digit[1] = LoByte Dig 1	' = 5
    Digit[2] = LoByte Dig 2	' = 0
    Digit[3] =  0	' no need to dig because byte 3 decimal places max
    Digit[4] =  0	' no need to dig because byte 3 decimal places max
    
    If HiByte.0 = 1 then
    	Digit[0] = Digit[0] +6	
    	Digit[1] = Digit[1] +5	
    	Digit[2] = Digit[2] +2	
    If HiByte.1 = 1 then
    	Digit[0] = Digit[0] +2
    	Digit[1] = Digit[1] +1
    	Digit[2] = Digit[2] +5
    	
    If HiByte.2 = 1 then
    	Digit[0] = Digit[0] +4
    	Digit[1] = Digit[1] +2
    	Digit[3] = Digit[3] +1
    	
    If HiByte.3 = 1 then
    	Digit[0] = Digit[0] +8	
    	Digit[1] = Digit[1] +4		
    	Digit[3] = Digit[3] +2	
    	
    If HiByte.4 = 1 then
    	Digit[0] = Digit[0] +6	'=13
    	Digit[1] = Digit[1] +9	'=14
    	Digit[3] = Digit[3] +4	'=4
    	
    If HiByte.5 = 1 then
    	Digit[0] = Digit[0] +2	'=15
    	Digit[1] = Digit[1] +9	'=23
    	Digit[2] = Digit[2] +1	'=1
    	Digit[3] = Digit[3] +8	'=12
    	
    If HiByte.6 = 1 then
    	Digit[0] = Digit[0] +4
    	Digit[1] = Digit[1] +8
    	Digit[2] = Digit[2] +3
    	Digit[3] = Digit[3] +6
    	Digit[4] = Digit[4] +1
    
    If HiByte.7 = 1 then
    	Digit[0] = Digit[0] +8
    	Digit[1] = Digit[1] +6
    	Digit[2] = Digit[2] +7
    	Digit[3] = Digit[3] +2
    	Digit[4] = Digit[4] +3
    
    Digit[1] = Digit[1] + Digit[0] Dig 1		'=24
    Digit[0] = Digit[0] Dig 0			'=5  DIGIT0
    Digit[2] = Digit[2] + Digit[1] Dig 1		'=3
    Digit[1] = Digit[1] Dig 0			'=4  DIGIT1
    Digit[3] = Digit[3] + Digit[2] Dig 1		'=12
    Digit[2] = Digit[2] Dig 0			'=3  DIGIT2
    Digit[4] = Digit[4] + Digit[3] Dig 1		'=1 DIGIT4
    Digit[3] = Digit[3] Dig 0			'=2  DIGIT3
    Good Luck
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

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


    Did you find this post helpful? Yes | No

    Wink Lucky

    Quote Originally Posted by blainecf
    When I take my shoes off, I can see my toes, so I can count to 20.

    When I count to 5, I only need to see one hand, but to 10, I need to see both hands.
    I can only count to 10, toes are too far to count, belly too big to reach!

  10. #10
    rlampus's Avatar
    rlampus Guest


    Did you find this post helpful? Yes | No

    Default Thankyou.

    Quote Originally Posted by paul borgmeier
    As I have said in the past, there has got to be an easier way....but this might get your ball rolling. I worked it assuming you have no WORD variables and only BYTES. (i.e., I assumed you had a 16 bit number composed of two 8 bit variables instead of your 32 bit number composed of two 16 bit words. Expanding the below to DOUBLE WORDS is similar, just a lot more lines.) (Yes, I know we have WORDS in PBP – I am just demonstrating a process). -THIS IS UNTRIED IN ACTUAL CODE BUT WORKS ON PAPER-

    Background
    bit 1 = 1
    bit 2 = 2
    bit 3 = 4
    bit 4 = 8
    bit 5 = 16
    bit 6 = 32
    bit 7 = 64
    bit 8 = 128
    ----------------
    bit 9 = 256
    bit 10 = 512
    bit 11 = 1024
    bit 12 = 2048
    bit 13 = 4096
    bit 14 = 8192
    bit 15 = 16384
    bit 16 = 32768

    Code:
    ' Example: Dig 12345 (assuming WORDS not available)
    HiByte VAR BYTE
    LoByte VAR BYTE
    Digit VAR byte[5]
    HiByte = $30	' high byte of 12345 ($30 = 00110000)
    LoByte = $39 ' low byte of 12345
    
    Digit[0] = LoByte Dig 0	' = 7
    Digit[1] = LoByte Dig 1	' = 5
    Digit[2] = LoByte Dig 2	' = 0
    Digit[3] =  0	' no need to dig because byte 3 decimal places max
    Digit[4] =  0	' no need to dig because byte 3 decimal places max
    
    If HiByte.0 = 1 then
    	Digit[0] = Digit[0] +6	
    	Digit[1] = Digit[1] +5	
    	Digit[2] = Digit[2] +2	
    If HiByte.1 = 1 then
    	Digit[0] = Digit[0] +2
    	Digit[1] = Digit[1] +1
    	Digit[2] = Digit[2] +5
    	
    If HiByte.2 = 1 then
    	Digit[0] = Digit[0] +4
    	Digit[1] = Digit[1] +2
    	Digit[3] = Digit[3] +1
    	
    If HiByte.3 = 1 then
    	Digit[0] = Digit[0] +8	
    	Digit[1] = Digit[1] +4		
    	Digit[3] = Digit[3] +2	
    	
    If HiByte.4 = 1 then
    	Digit[0] = Digit[0] +6	'=13
    	Digit[1] = Digit[1] +9	'=14
    	Digit[3] = Digit[3] +4	'=4
    	
    If HiByte.5 = 1 then
    	Digit[0] = Digit[0] +2	'=15
    	Digit[1] = Digit[1] +9	'=23
    	Digit[2] = Digit[2] +1	'=1
    	Digit[3] = Digit[3] +8	'=12
    	
    If HiByte.6 = 1 then
    	Digit[0] = Digit[0] +4
    	Digit[1] = Digit[1] +8
    	Digit[2] = Digit[2] +3
    	Digit[3] = Digit[3] +6
    	Digit[4] = Digit[4] +1
    
    If HiByte.7 = 1 then
    	Digit[0] = Digit[0] +8
    	Digit[1] = Digit[1] +6
    	Digit[2] = Digit[2] +7
    	Digit[3] = Digit[3] +2
    	Digit[4] = Digit[4] +3
    
    Digit[1] = Digit[1] + Digit[0] Dig 1		'=24
    Digit[0] = Digit[0] Dig 0			'=5  DIGIT0
    Digit[2] = Digit[2] + Digit[1] Dig 1		'=3
    Digit[1] = Digit[1] Dig 0			'=4  DIGIT1
    Digit[3] = Digit[3] + Digit[2] Dig 1		'=12
    Digit[2] = Digit[2] Dig 0			'=3  DIGIT2
    Digit[4] = Digit[4] + Digit[3] Dig 1		'=1 DIGIT4
    Digit[3] = Digit[3] Dig 0			'=2  DIGIT3
    Good Luck

    Thankyou. This is very helpful.

    R Lampus

  11. #11
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    You might also want to take a look at this thread http://www.picbasic.co.uk/forum/showthread.php?t=1942
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Nokia 3310 display text
    By chai98a in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th August 2007, 03:39
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

Members who have read this thread : 1

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

Posting Permissions

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