i would like to do a password system to turn ON RB0's LED. For example, the password is "1111".
My problem is i don't know how to use "fgets()" for UART.
Below is my code (with missing code for "fgets()"):
#include <16F628A.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP,HS
#include <stdio.h>
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1)
void main()
{
printf("Please enter password\n");
while(1)
{
if (fgets( )) //inside the "fgets( )" should be the password code "1111"
output_a(0b00000001);
else
printf("Password Wrong\n");
}
}
Picture of Cirucit Design: http://www.imagehosting.com/show.php/1629177_UART.JPG.html
Thanks.
My problem is i don't know how to use "fgets()" for UART.
Below is my code (with missing code for "fgets()"):
#include <16F628A.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP,HS
#include <stdio.h>
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1)
void main()
{
printf("Please enter password\n");
while(1)
{
if (fgets( )) //inside the "fgets( )" should be the password code "1111"
output_a(0b00000001);
else
printf("Password Wrong\n");
}
}
Picture of Cirucit Design: http://www.imagehosting.com/show.php/1629177_UART.JPG.html
Thanks.