Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

pbasic code to convert to ascii

Status
Not open for further replies.

devil6600

Full Member level 5
Joined
Nov 15, 2008
Messages
250
Helped
7
Reputation
14
Reaction score
7
Trophy points
1,298
Activity points
2,931
hi everyone,

i am using picbasic to read pulse from a pin.
i am able to read pulse but this pulse is in the form of character, now i want to convert this character to a numeric value, how to do it? for example in the below code if i get b0 variable value as 'D' (letter D) then how to convert it to number. As you can see i am using # sign to convert it to number for serial output, but i need to know this number before outputting.

Code:
INCLUDE "modedefs.bas"
b0 var byte
main:
pulsin portb.6, 1, b0
SEROUT portb.4,N9600,[#b0,10]
GOTO main
thanks
 

dayanpad

Advanced Member level 4
Joined
Mar 23, 2009
Messages
114
Helped
17
Reputation
34
Reaction score
17
Trophy points
1,298
Location
Colombo
Activity points
1,921
hi everyone,

i am using picbasic to read pulse from a pin.
i am able to read pulse but this pulse is in the form of character, now i want to convert this character to a numeric value, how to do it? for example in the below code if i get b0 variable value as 'D' (letter D) then how to convert it to number. As you can see i am using # sign to convert it to number for serial output, but i need to know this number before outputting.

Code:
INCLUDE "modedefs.bas"
b0 var byte
main:
pulsin portb.6, 1, b0
SEROUT portb.4,N9600,[#b0,10]
GOTO main
thanks

E.g. to compare "A" to the number 65 which is its decimal equivalent?
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top