|
|
View previous topic :: View next topic |
Author |
Message |
acsg
Joined: 25 Apr 2021 Posts: 8 Location: Rio de Janeiro - Brazil
|
Show 8 bytes hex to lcd |
Posted: Fri Aug 13, 2021 9:07 am |
|
|
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: 303
|
|
Posted: Fri Aug 13, 2021 9:59 am |
|
|
%X is for 8 bit values, you want %lX for a long hex value |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Fri Aug 13, 2021 10:23 am |
|
|
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
|
|
Posted: Fri Aug 13, 2021 12:47 pm |
|
|
Guys, SOLVED !
God bless you very much !! _________________ "For by wise counsel you will wage your own war."
Pv24:6 |
|
|
|
|
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
|