Saturday, April 19, 2008
eeping track of keys or remembering a combination password, or PIN. It can only be opened when an authorized user is present, since there are no keys or combinations to be copied or stolen, or locks that can be picked.
For more details visit www.8051projects.info
Monday, December 10, 2007
Monday, November 19, 2007
So lets start off with designing a communications protocol. From VB we will send an ASCII 255, as a synch byte, and the on/off state (0 or 1). The microcontroller will wait for two (2) bytes of data. After these two bytes of data are received, it will then either switch on/off the LED
Visual Basic at PC side
To get started open Visual Basic.
Start a new Standard EXE.
Next go to the Project | Components... menu
Check the Microsoft Comm control 6.0.
Next double-click on the yellow phone in the toolbar to add the MSComm control to your form.
Now add two option buttons from the tool bar name as "opton" and "optoff", change the caption to ON and OFF for both buttopns.
Now add a command button named cmdsend from the tool bar, and chage the caption to "SEND"
On To The Code
Now that the form is set up and ready to go, we need to start adding our code to the project. The user will select a pin state from option button, and then click cmdSend to send the data to the microcontroller. So first of all we need to set up the MSComm control, and select one of the pin states to start with. So lets add the following code to our form...
Private Sub Form_Load()
On Error Resume Next
'use comm port 1
MSComm1.CommPort = 1
' 9600 baud, no parity, 8 data bits, 1 stop bit
MSComm1.Settings = "9600,N,8,1"
' Disable DTR
MSComm1.DTREnable = False
'open the port
MSComm1.PortOpen = True
Now we just need to add the code to send the data. When the user presses cmdSend, we need to do three things.
Get the pin state...
Send the data...
Now lets put it all together and send the data when we press the cmdSend button...
Private Sub cmdsend_Click()
Dim LED As Long
' Get LED State
If opton.Value = True Then
LED = 0
LED = 1
' Send Out Data
MSComm1.Output = Chr$(255) & Chr$(LED)
So we sent out the synch byte (255),followed by the LED state.
Finally we need to close the comm port when the VB project unloads so...
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False 'Close the COMM port
That's all at the PC side
Program the MIcrocontroller with the following code
ORG 00H ; Reset
MOV TMOD,#20H ;enable timer1, mode 2 (auto reload)
MOV TH1,#0FDH ;9600 Baud rate
MOV SCON,#50H ;8 bit, 1 stop bit, REN enabled
HERE:JNB RI,HERE ;wait for character to come in
MOV A,SBUF ;get data in A
CJNE A,#0FFH,DOWN ;chk if the char is synch byte ie.offh or 255
;if not jump to clear RI
CLR RI ;get ready to get next byte
WAIT:JNB RI,WAIT ;wait for character to come in
MOV A,SBUF ;get data in A
CJNE A,#00H,NXT ;chk if the char is 0
CLR P2.0 ;switch on LED
SJMP DOWN ;jump to clear RI
NXT:CJNE A,#01H,DOWN ;chk if the char is 1
SETB P2.0 ;switch off LED
DOWN:CLR RI ;get ready to get next byte
SJMP HERE ;keep getting the data
Now run the VB project, select either ON or OFF, and press send. You should see the LED turn ON when you send a ON command, and turn OFF when you send a OFF command.
Visit http://www.8051projects.info for more details
Wednesday, October 31, 2007
Monday, September 24, 2007
Now-a-days every institution needs automation. As a part of college automation, we have decided to do a project “Voice Interactive System for College Automation”. Our project allows the user to know the student’s attendance and marks quickly through the telephone line without the intention of the college authority. In the hardware side embedded system has been used. A 20 pin microcontroller 89C2051 is used because of its compatibility with our hardware. This microcontroller controls the whole hardware. Telephone line is used for communication purpose. Visual Basic has been used for software programming. Presentation in the class and outcome of the university are made reachable to the parents by our project. It will be very obliging to the parents to be acquainted with their son’s/daughter’s recital in the college.