Relay


Closed Thread
Results 1 to 15 of 15

Thread: Relay

Hybrid View

  1. #1
    Join Date
    Jun 2008
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Thanks....

  2. #2
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Question code

    ok i get how to connect it to the pic but what i need to know is how to write code for the operation of the relay. I want to switch the relay on when it reaches a setpoint value of 30 degrees. How would i do that?

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kalind View Post
    ok i get how to connect it to the pic but what i need to know is how to write code for the operation of the relay. I want to switch the relay on when it reaches a setpoint value of 30 degrees. How would i do that?
    When WHAT reaches a setpoint value of 30 degrees?
    The timing advance on my lawnmower?
    The temperature on the North Pole? On Mars?

  4. #4
    Join Date
    Oct 2008
    Posts
    47


    Did you find this post helpful? Yes | No

    Default

    I'm doing a temperature control system. Pretty new to PIC programming. I have managed to display temperature on the LCD using an LM35 sensor and a 16 x 2 lcd with a 16F873. I want to add on a 4 x4 matrix keypad so that i can set setpoints to switch a relay and a low warning buzzer I have no idea how to program for the above mentioned add-ons. Please could someone help me. below is my code which will obviously need additions and a scematic of my circuit is attached . Please could somebody help me with this!!

    ' Define LCD registers and bits

    Define LCD_DREG PORTB
    Define LCD_DBIT 0
    Define LCD_RSREG PORTB
    Define LCD_RSBIT 5
    Define LCD_EREG PORTB
    Define LCD_EBIT 4
    dEFINE LCD_BITS 4
    DEFINE LCD_LINES 2

    adval var word ' Create adval to store result
    temp var word ' Create temp to store result
    temp1 var word ' Create temp1 to store result

    TRISA = %11111111 ' Set PORTA to all input
    ADCON1 = %10000010 ' Set PORTA analog and RIGHT justify result
    ADCON0 = %11000001 ' Configure and turn on A/D Module
    Pause 100 ' Wait 0.1 second


    loop: ADCON0.2 = 1 ' Start Conversion

    AGAIN: Pause 1
    If ADCON0.2 = 1 Then AGAIN ' Wait for low on bit-2 of ADCON0, conversion finished

    adval.highbyte = ADRESH ' Move HIGH byte of result to adval
    adval.lowbyte = ADRESL ' Move LOW byte of result to adval

    Lcdout $fe, 1 ' Clear screen
    temp=50*adval ' Conversion to Degrees
    temp=temp/100
    Lcdout "TEMP = ",DEC temp,$DF,"C" ' Display the value of temp
    temp1 = temp*18 ' Conversion to Fahrenheit
    temp1 = temp1+320
    temp1 = temp1/10
    lcdout $FE,$C0, "TEMP = ",dec temp1,$DF,"F" ' Display the value of temp
    Pause 1000 ' Wait 1 second

    Goto loop ' Do it forever
    End
    Attached Images Attached Images  

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kalind View Post
    I'm doing a temperature control system.
    No kidding...just like the other post says...
    Don't double post!

  6. #6
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    If temp>=setpoint then
    high pin
    else
    Low Pin
    endif

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by aratti View Post
    If temp>=setpoint then
    high pin
    else
    Low Pin
    endif
    Where have I seen something like that before?

Similar Threads

  1. Need Help
    By PVBiljon in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th May 2009, 17:04
  2. Replies: 24
    Last Post: - 7th November 2008, 04:41
  3. Serin to Serin2 ??
    By Gixxer in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th January 2008, 03:56
  4. Serial Relays
    By tazntex in forum General
    Replies: 3
    Last Post: - 17th May 2007, 17:42
  5. Replies: 22
    Last Post: - 9th April 2007, 15:25

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts