Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Error with unsigned int

Status
Not open for further replies.

Thomas Sabu Ichippillil

Newbie level 4
Newbie level 4
Joined
Jun 22, 2013
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
Cochin, Kerala, India
Visit site
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);
}
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top