dandansmi
Newbie level 2
i am compleatly new to microcontolling, i am on an enginneering course studying micros. I am using a PIC16F690 with 4 LEDS, i am trying to write a simple program in mplab for a transmitter and reciver through a cable and batterys to power each board. i have a transmitter program where i have 1 LED flashing. I am trying to mimic that program on the reciver, but also if i plug in any other transmitter program the reciver will recognise it and mimic it.
i am using portA as an input and PORTC as an output.
i have had a go at writing a program but it may be compleatly wrong and make me look stupid. i will include it below. thank you soo much for all ur help i really need it.
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
cblock 0x20
endc
org 0
Start:
bsf STATUS,RP0 ; select Register Page 1
TRISA 0x00 ; Make PortA all input
TRISC 0x00 ; Make PortC all output
bcf STATUS,RP0 ; back to Register Page 0
MainLoop:
movlw PORTC ;moving output information in port C too W register
movwf 0x00 ;moving all LEDS in portc to F register
movf PORTA ;moving F register too port A
clrf 0X00 ;clearing portA ALL leds
movf PORTC ;moving portA back to port c
goto MainLoop ;repeat
end
i am using portA as an input and PORTC as an output.
i have had a go at writing a program but it may be compleatly wrong and make me look stupid. i will include it below. thank you soo much for all ur help i really need it.
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
cblock 0x20
endc
org 0
Start:
bsf STATUS,RP0 ; select Register Page 1
TRISA 0x00 ; Make PortA all input
TRISC 0x00 ; Make PortC all output
bcf STATUS,RP0 ; back to Register Page 0
MainLoop:
movlw PORTC ;moving output information in port C too W register
movwf 0x00 ;moving all LEDS in portc to F register
movf PORTA ;moving F register too port A
clrf 0X00 ;clearing portA ALL leds
movf PORTC ;moving portA back to port c
goto MainLoop ;repeat
end