CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Show 8 bytes hex to lcd

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
acsg



Joined: 25 Apr 2021
Posts: 8
Location: Rio de Janeiro - Brazil

View user's profile Send private message

Show 8 bytes hex to lcd
PostPosted: Fri Aug 13, 2021 9:07 am     Reply with quote

Hi Guys,

My problem is: I can't show the entire hex code on LCD ...
Code:

#include <16F88.h>

#fuses NOWDT,NOPROTECT,PUT,NOLVP, NOMCLR,INTRC_IO, NODEBUG   
#use delay(clock = 8MHz)
#use i2c(Master,Fast=100000, sda=PIN_B1, scl=PIN_B4,force_sw)

#include "i2c_Flex_LCD.c"
 
unsigned int32 code;

void main() {
  setup_oscillator(OSC_8MHZ);              // Set internal oscillator to  8MHz
 
  lcd_init(0x7E,16,2);
  lcd_backlight_led(ON); //Underground light
   
  printf(lcd_putc, "\fTeste Hex");  // "Text hex" shown normally

 code = 0x3FCF00FF;

     while(TRUE){   
   
      if(code == 0x3FCF00FF)

         {
          output_toggle(LED);     
          printf(lcd_putc, "\f%X",code);
         }

     }

// After that LCD shows "FF". If i use "\f%8X", i see 000000FF. I should see "3FCF00FF"
_________________
"For by wise counsel you will wage your own war."
Pv24:6
gaugeguy



Joined: 05 Apr 2011
Posts: 288

View user's profile Send private message

PostPosted: Fri Aug 13, 2021 9:59 am     Reply with quote

%X is for 8 bit values, you want %lX for a long hex value
temtronic



Joined: 01 Jul 2010
Posts: 9105
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Aug 13, 2021 10:23 am     Reply with quote

BTW that's a lower case 'L'...not the number '1'.
Can be confusing depending on monitor, font, colour and when the coffeepot's empty....
acsg



Joined: 25 Apr 2021
Posts: 8
Location: Rio de Janeiro - Brazil

View user's profile Send private message

PostPosted: Fri Aug 13, 2021 12:47 pm     Reply with quote

Guys, SOLVED !

God bless you very much !!
_________________
"For by wise counsel you will wage your own war."
Pv24:6
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group