Thomas Sabu Ichippillil
Newbie level 4
- Joined
- Jun 22, 2013
- Messages
- 5
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Location
- Cochin, Kerala, India
- Activity points
- 37
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: