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.

pic16F690 Trying to create program that takes input from a sensor and outputs to LED

Status
Not open for further replies.

ApacheOmega

Newbie level 1
Newbie level 1
Joined
Dec 7, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Huntsville AL.
Visit site
Activity points
1,288
In assembly language how do I write code to take input from a sensor and turns on a LED?
I'm writing an assembly program that will read information from a sensor that will detect whether its raining or not. the sensor will be the input and the LED will be the output indicating that its raining.
I have code written for 5 other weather conditions but right now I just want to figure out the most basic which is rain.

here's my code///////////////////////////I just want to know if I'm headed in the right direction, If not do you have any suggestions///////////////////
Code:
#include <p16F690.inc>
;----------------------------
;define equates here
;----------------------------
count equ 0x00
sum equ 0x09

rainLed equ 4
rainSensor 10

dayOrNightLed equ 3
dayOrNightSensor 9

windLed equ 2
windSensor 8

snowLed equ 1
snowSensor 7

tempLed equ 0
tempSensor 6

fogLed equ 0
foqSensor 5

;---------------------------
;start of program
;---------------------------

org 0x0000 ; tells program to start at first location
start:

BSF status, RP0 ; select bank 1
BCF status RP1

movlw b'11111000' ; make bank 5-10 inputs
movwf TRISA ;make bank 4-0 output

BCF status RP0 ;bit clear file
BCF status RP1

;------------------------------
;Loop
;-----------------------------
BTFSS PortA, rainSensor
BSF PortA,rainLed
is this part right so far?????????????????
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top