kle0ps
Junior Member level 2
Hello
I got a assigment at my university which i must build a home security alarm. I use the microcontroller pic18f2520. I connect lcd on PORTA and keypad on PORTB and i want to connect contact magnetic on PORTC and i dont know how.
I bought this one:
Does anyone help me how to connect the contact magnetic and with the code please?
Thank you
I got a assigment at my university which i must build a home security alarm. I use the microcontroller pic18f2520. I connect lcd on PORTA and keypad on PORTB and i want to connect contact magnetic on PORTC and i dont know how.
I bought this one:
Thats my code:**broken link removed**
Code:
#include <p18f2520.h>
#pragma config WDT=OFF , OSC=INTIO67 , PWRT = ON, LVP=OFF, MCLRE = OFF
#include <delays.h>
// lcd code
//...
//...
//keypas code
//....
//...
void main (void)
{
ADCON1 = 0x7F; //all IO are digital or 0b01111111 in binary
TRISA = 0b00100000; //sets PORTA
PORTA = 0b00000000; //turns off PORTA outputs
TRISB = 0b10001111; //sets PORTB bits 0-3 and 7 as inputs, 4-6 as outputs
PORTB = 0b00000000; //turns off PORTB outputs
TRISC = 0b00000000; //sets PORTC as outputs
PORTC = 0b00000000; //turns off PORTC outputs
INTCON2bits.RBPU=0;
SetAddr (0x80);
WriteString("HELLO WORLD");
Does anyone help me how to connect the contact magnetic and with the code please?
Thank you
Last edited: