INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

need help with programming a machine to take input from sensor

need help with programming a machine to take input from sensor

need help with programming a machine to take input from sensor

(OP)
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 --> assembly

#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?????????????????

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close