Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pic16F628a Usart

Status
Not open for further replies.

funky gibbon

New Member
Hello All,
First post here, so im using a 16f628a to read the bit status on portA and send the value through rs232 to laptop, everything works, but i dont know how to send a numeric value, at the moment i get ascii characters in the term window when what i really want is say 0x80 to apear when bit 7 is high and so on, does that make any sence, im programming in asm, i know the equivalent in pic basic would be $hex to output hex, what im geting is $char
sorry i havent explained myself well here

thanks in advance
 
I have used something like this;

Code:
;
;  Print byte in W as two ASCII nybbles
;
PutByte movwf   TEMP            ; save byte                       |B0
        swapf   TEMP,W          ; swap nybbles in W               |B0
        call    Hex2Asc         ; process left nybble             |B0
        movf    TEMP,W          ; process right nybble            |B0
Hex2Asc andlw   b'00001111'     ; mask off left nybble            |B0
        addlw   h'36'           ;                                 |B0
        btfsc   STATUS,DC       ;                                 |B0
        addlw   h'07'           ;                                 |B0
        addlw   0-6             ; ($FA)                           |B0
        goto    Put232          ; print ASCII nybble              |B0
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top