Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Need PIC16F84A Cool Project

On who do your most project ideas depend on?

  • Self

    Votes: 0 0.0%
  • Friend

    Votes: 0 0.0%
  • Teacher - School

    Votes: 0 0.0%
  • Online Search (Somebody else's idea revisited)

    Votes: 0 0.0%

  • Total voters
    0
Status
Not open for further replies.
Agent 009 said:
Euh... My teacher adviced me 2 use it, bc it's easier to get the LCD to work... Anyway, I'm not bad in programming, and I learn fast... So assembly is not much of a prob: I have taken already 2 courses, using assembly (Computer Architecture and Microprocessor Design) and have had exellent performance 8) ...
Ok, do as you want. You feel pretty confident with yourself :)
 
Though I was very confident of Basic Pro... It turned out 2 be the same blocks :cry: :!: :!:
My Code:
symbol second = 1000
pause second
lcdout $FE, 1
lcdout "PIC LCD - ROW1"
LCDout $FE, $0C
lcdout "PIC LCD - ROW2"
STOP
end
 
Agent 009 said:
Though I was very confident of Basic Pro... It turned out 2 be the same blocks :cry: :!: :!:
My Code:
symbol second = 1000
pause second
lcdout $FE, 1
lcdout "PIC LCD - ROW1"
LCDout $FE, $0C
lcdout "PIC LCD - ROW2"
STOP
end
I still think you have HW problem. So why don't you post us the photo of the device???
 
It WORKED :lol: :lol: :lol: :!: :!: :!:
2day, it worked... Now I don't think I have a problem with the LCD anymore (I hope so)...
The keypad now arises...
I can't use nigel's tutorials cause i'm using PIC BASIC, and the keypad, which was supposed to work as Nigel AND my teacher said, is NOT working like that!!! What the matter?
The keypad is a 4 x 3 (0 - 9 with # and *)...
 
Really weird: I connected a LED to +5V from one end and to a 10k resistor from the other. I have the keypad connected to ground from one of its connectors (There are 7, 3 cols & 4 rows) and to the resistor from another... No logical pattern appeared! It's completely not like Nigel and my teacher said and not how it's supposed to be :? ... I got the following intersections:
Row 1 has connector 2 as common
Row 3 has connector 6 as common
Row 4 has connector 4 as common
Col 1 has connector 3 as common
Col 2 has connector 1 as common
Col 5 has connector 5 as common

Someone can interpret this???
 
I got it right...
The columns got the odd pins, and the rows, the even ones, except the last one, which is odd... The keypad worked great, but it seems the row of 4-5-6 is corrupt: nothing is happening... The project was left in the laboratory, so as soon as I get it, I'll post its picture...
 
Meanwhile, here's my code, in PIC BASIC to run the program...
'****************************************************************
'* Name : LCDprog1.BAS *
'* Author : Paul-Marc Bougharios, ID: 20020519 *
'* Notice : Copyright (c) 2005 B.I.O. *
'* : All Rights Reserved *
'* Date : 6/12/2005 *
'* Version : 1.0 *
'* Notes : THANK YOU MY GOD!!! *
'* : The program starts now the real stuff... *
'* : God, please enlighten me. Thank You For You Love. *
'* : The program loads in 2 modes: *
'* : Save Code Mode: to save the 4-digit code in mem. *
'* : Check Code Mode: to enter the code and compare it *
'* : with the saved one... *
'****************************************************************
' Symbols
symbol second = 1000
symbol del1 = 200
symbol del2 = 70

' Variables
cnt var byte
cn2 var byte
p10 var byte
key var byte
code var byte
sCode var byte

' Columns
col1 var PORTB.0
col2 var PORTB.1
col3 var PORTB.2
' Rows
row1 var PORTB.4
row2 var PORTB.5
row3 var PORTB.6
row4 var PORTB.7

' Temporary variables for buttons
tmp1 var byte
tmp2 var byte
tmp3 var byte
tmp4 var byte



'*****************
' Start of Program
pause second
lcdout $FE,1,"Load Program...",$FE,$C0
pause second
' Teach PortB
TRISB=%11110000 ' Have RB4-7 as inputs
lcdout "Press Any Key..."
gosub getkey
if key = -2 then
goto saveCode
else
goto enterCode
endif

saveCode:
lcdout $FE,1,"Save Code Mode"
' Ask for Code
lcdout $FE,$C0,"Enter Code: "
code = 0
for cnt = 0 to 3
gosub getKey
gosub power
code = code + key * p10
next
write $3F8, code
goto endProg
enterCode:
lcdout $FE,1,"Check Code Mode"
' Ask for Code
lcdout $FE,$C0,"Enter Code: "
code = 0
for cnt = 0 to 3
gosub getKey
gosub power
code = code + key * p10
next
read $3F8, sCode
if code = sCode then
goto success
else
goto fail
endif

endProg:
lcdout $FE,$C0,"Program Ended..."
loop: goto loop

power:
p10 = 1
for cn2 = 0 to cnt
p10 = p10 * 10
next cn2
return

success:
lcdout $FE,1,"Authenticated..."
goto endProg

fail:
lcdout $FE,1,"Unauthorized..."
goto endProg
'*************
' Program Loop
'loop:
' gosub getKey

' goto loop

'************
' Key Grabber
getKey:
' Send 1's to columns
col1=1
col2=1
col3=1

' Initialize Debouncing variables
tmp1=0
tmp2=0
tmp3=0
tmp4=0

' Pause a little, for speed
pause del1

button row1,1,255,0,tmp1,1,lbl_R1
button row2,1,255,0,tmp2,1,lbl_R2
button row3,1,255,0,tmp3,1,lbl_R3
button row4,1,255,0,tmp4,1,lbl_R4

' Wait for user input
goto getKey
gotKey:
' Have the key, and saved it in 'key'

return

lbl_R1:
' Turn off all columns, then 1 by 1, to get correct pin
col1=1
col2=0
col3=0

' Check row, again, for column 1
tmp1=0
button row1,1,255,0,tmp1,1,lbl_R1C1

' Low column 1, high column 2
col1=0
col2=1
col3=0

' Check row, again, for column 2
tmp1=0
button row1,1,255,0,tmp1,1,lbl_R1C2

' Low column 1,2 high column 3
col1=0
col2=0
col3=1

' Check row, again, for column 3
tmp1=0
button row1,1,255,0,tmp1,1,lbl_R1C3

' Get Back, akhiran
goto getKey

lbl_R2:
' Turn off all columns, then 1 by 1, to get correct pin
col1=1
col2=0
col3=0

' Check row, again, for column 1
tmp2=0
button row2,1,255,0,tmp2,1,lbl_R2C1

' Low column 1, high column 2
col1=0
col2=1
col3=0

' Check row, again, for column 2
tmp2=0
button row2,1,255,0,tmp2,1,lbl_R2C2

' Low column 1,2 high column 3
col1=0
col2=0
col3=1

' Check row, again, for column 3
tmp2=0
button row2,1,255,0,tmp2,1,lbl_R2C3

' Get Back, akhiran
goto getKey

lbl_R3:
' Turn off all columns, then 1 by 1, to get correct pin
col1=1
col2=0
col3=0

' Check row, again, for column 1
tmp3=0
button row3,1,255,0,tmp3,1,lbl_R3C1

' Low column 1, high column 2
col1=0
col2=1
col3=0

' Check row, again, for column 2
tmp3=0
button row3,1,255,0,tmp3,1,lbl_R3C2

' Low column 1,2 high column 3
col1=0
col2=0
col3=1

' Check row, again, for column 3
tmp3=0
button row3,1,255,0,tmp3,1,lbl_R3C3

' Get Back, akhiran
goto getKey

lbl_R4:
' Turn off all columns, then 1 by 1, to get correct pin
col1=1
col2=0
col3=0

' Check row, again, for column 1
tmp4=0
button row4,1,255,0,tmp4,1,lbl_R4C1

' Low column 1, high column 2
col1=0
col2=1
col3=0

' Check row, again, for column 2
tmp4=0
button row4,1,255,0,tmp4,1,lbl_R4C2

' Low column 1,2 high column 3
col1=0
col2=0
col3=1

' Check row, again, for column 3
tmp4=0
button row4,1,255,0,tmp4,1,lbl_R4C3

' Get Back, akhiran
goto getKey

lbl_R1C1:
lcdout "2"
key = 2
goto gotKey

lbl_R1C2:
lcdout "1"
key = 1
goto gotKey

lbl_R1C3:
lcdout "3"
key = 3
goto gotKey

lbl_R2C1:
lcdout "0"
key = 0
goto gotKey

lbl_R2C2:
lcdout $FE,1
key = -2
goto gotKey

lbl_R2C3: ' Like Backspace, delete one character backwards
lcdout $FE,$10," ",$FE,$10
key = -1
goto gotKey

lbl_R3C1:
lcdout "8"
key = 8
goto gotKey

lbl_R3C2:
lcdout "7"
key = 7
goto gotKey

lbl_R3C3:
lcdout "9"
key = 9
goto gotKey

lbl_R4C1:
lcdout "5"
key = 5
goto gotKey

lbl_R4C2:
lcdout "4"
key = 4
goto gotKey

lbl_R4C3:
lcdout "6"
key = 6
goto gotKey

end ' Mich daroureh, bass yalla...
 
Anyway, my code is working 8) man!!! I'm posting it just to help others 8) :lol: ... It's working because I've tried it, download it on the PIC, AND made a final project presentation abt it... I have a small memory problem, though... Last time I ran the prog, the PIC didn't seem to be memorizing any code at all :? ...
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top