Dear All,
i wrote the following a code for pic16f88. But not getting the correct output.
I am getting the correct output till b=0 to 32768. but if i give the value greater than 32768, am obtaining an undesired output with a negative symbol. Someone please help me. Thanks in advance.
#include<htc.h>
#include<stdio.h>
#include "lcd.h"
#define _XTAL_FREQ 4e6
void main()
{
ANSELH=0x00;
TRISB=0x01;
PORTB=0x00;
lcd_init();
lcd_clear();
unsigned int b=65535;
char a[10]="0";
while(1)
{
sprintf(a,"%d",b);
lcd_goto(0);
lcd_puts(a);
}
i wrote the following a code for pic16f88. But not getting the correct output.
I am getting the correct output till b=0 to 32768. but if i give the value greater than 32768, am obtaining an undesired output with a negative symbol. Someone please help me. Thanks in advance.
#include<htc.h>
#include<stdio.h>
#include "lcd.h"
#define _XTAL_FREQ 4e6
void main()
{
ANSELH=0x00;
TRISB=0x01;
PORTB=0x00;
lcd_init();
lcd_clear();
unsigned int b=65535;
char a[10]="0";
while(1)
{
sprintf(a,"%d",b);
lcd_goto(0);
lcd_puts(a);
}
Last edited: