morgan
Joined: 24 Jul 2010 Posts: 1
|
Generate Morse Code by Mplab. Need Help! |
Posted: Sat Jul 24, 2010 8:13 pm |
|
|
I need to implement the software to read a four bit values from the input port and then generate the Morse code serial output to one output port. An example of a PIC program to test the Morse code generator function is shown below. In addition, use the RAM (File Register are 0x0c to 0x4f) to store the results of computations and use the working register to pass the input and output values.
I need to write a version of the Morse code program in PIC assembly code and test with the main program.
Code: |
; Outline of PIC assembly program
; (16F84 with RC osc, watchdog timer off, power-up timer on)
processor 16f84A
include
__config _RC_OSC & _WDT_OFF & _PWRTE_ON
; beginning of program code
org 0x00 ; reset at address 0
reset: goto init ; skip reserved program addresses
org 0x08 ; beginning of user code
init:
; At startup, all ports are inputs.
bsf STATUS,RP0 ; switch to bank 0 memory
clrf TRISB ; set PORTB to all outputs
bcf STATUS,RP0 ; return to bank 1 memory
mloop:
; here begins the main program
movf PORTA,w ; read stdin to w reg
call main
goto mloop
main:
; add your Morse Code here
;
; put your result into w-reg
call printf ; output the value
return ; main return
printf: ; only standard library function
movwf PORTB ; output w to stdout
return
end ; end of program code
|
I have several questions. How to write a Morse code in Mplab? I already know how to write it in C. Please give me some instructions. I need help. |
|