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.

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
 

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top