PIC programming (assembly code) help

Thread Starter

bluebrakes

Joined Oct 17, 2009
252
Hi,

Long time no see. :)

I'm working on a RS232 serial controller for my project. Basically turns on and off the pic outputs based on commands from the computer.

What I need help with is writing code that does an IF statement based on the character in the register.

So basically if I send an 'F' over the serial line, I want RB0 to turn on.

I'm not sure how to do the IF command in assembly code to compare a character against the register of the 16f628a pic.

I've managed to get my code to turn on LEDs, etc with just bashing any old key, but I need to be able to go the next stage.

Any ideas?
 

Thread Starter

bluebrakes

Joined Oct 17, 2009
252
i think this is the closest i've got with the code...

; So if the character in the register is character 0 then call step1
MOVLW 0h ; Check Reset Command
SUBWF TXREG, w
BTFSC STATUS, Z ; Does it match?
CALL step1 ; Yes
 

ErnieM

Joined Apr 24, 2011
8,377
Well... first off, wrong forum. Mods may move this.

A Capital "F" is a hex 0x46, lower case is 0x66. You need to monitor your data stream over the RS232, look for a match to that character, and if true then you'd just bsf PORTB, 0

Otherwise I can't suggest anything as I am bad at imagining source code.
 

Thread Starter

bluebrakes

Joined Oct 17, 2009
252
somehow i've cracked but the worst thing is i don't know why.... grrr!!!
the worst kind. thanks anyway.

The next problem is the pic code crashes or something when too much data is sent at once. It just stops responding to the commands.... hmmm.
 
Top