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.

help needed in transmitting numbers

Status
Not open for further replies.

asham

Junior Member level 1
Joined
Jan 24, 2006
Messages
19
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Activity points
1,454
hi...i urgently need help in c programming..i need to transmit numbers from the PIC18 to the PC Hyperterminal...I'm using USART for this...My programming is done with C18 COMPILER and MPLAB IDE...Any help will be very much appreciated..Thanks in advance:cry:
 

IanP

Advanced Member level 5
Joined
Oct 5, 2004
Messages
7,942
Helped
2,310
Reputation
4,622
Reaction score
531
Trophy points
1,393
Location
West Coast
Activity points
66,416
To transmit numbers to Hyperterminal, regardless of microcontroller type, you will need to convert them to ASCII code, for example, ASCII representation for 0 is 30H, 1 --> 31H, 2 --> 32H and so on ..
Just add 30H to any digit before transmission .. and "." --> 2EH
( https://www.lookuptables.com/ )

Regards,
IanP
 

asham

Junior Member level 1
Joined
Jan 24, 2006
Messages
19
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Activity points
1,454
Thanks very much IanP...I will do as you as suggested.But can you tell how to define it first.(int/char/unsigned int..etc)...Thanks
 

terka

Advanced Member level 4
Joined
Dec 15, 2003
Messages
100
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,298
Activity points
936
Code:
#device <16F628>
#use rs232(baud=9600,parity=n,xmit=pin_b2,rcv=pin_b1,bits=8)

main() {

while(1) {
int i;           //I from 48d= 0 in aschii, up to 57d= 9 in aschii.
for(i=48;i<58;i++) {
putc(i);      //Print from 0 up to 9
delay_ms(200);
}
}

Bye



[/code]
 

asham

Junior Member level 1
Joined
Jan 24, 2006
Messages
19
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Activity points
1,454
Thanks IanP...can i use unsigned int, coz i need to transmit quite some numbers.
Terka, i tried ur program but i'm unable to build the program....I'm using MPLAB IDE w/C18 COMPILER...when i try to compile the program or any of the working programs i have, it displays a msg "can't locate build tool,find tool location"...What does this mean...? Thank you.... :|
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top