[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2010-03-17T08:41:13-05:00 http://petesqbsite.com/phpBB3/app.php/feed/topic/2496 2010-03-17T08:41:13-05:00 2010-03-17T08:41:13-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=20526#p20526 <![CDATA[Update]]>
You are right that LPT ports are going away, and I also found my original program worked fine on some 98 computers but didn't on others so I went the Basic Stamp route as shown below... I'm pretty sure this is the latest verstion. I drive the speaker the same as I do the latch, through an opto. The additional hardware has the stamp, an onboard clock and a data-logger that I plug a thumb drive into. Anything I need to update other than the clock which I do from the keypad. The log file is kept on the thumb drive as well as the password files.

Danner

Code:

' {$STAMP BS2pe}' {$PBASIC 2.5}' =========================================================================''   File...... Door1.BS2pe'   Purpose... Electronic door latch controller'   Author.... Daniel Fuller'   E-mail.... qxotic@hotmail.com'   Started... 11 August 2009'   Updated... 21 September 2009' -----[ Program Description ]---------------------------------------------'' Provides entry control for a door.'' The (Grayhill series 88) keypad used for this program is layed out like this:''  --- --- ---' | 1 | 2 | 3 |   R1'  --- --- ---' | 4 | 5 | 6 |   R2'  --- --- ---' | 7 | 8 | 9 |   R3'  --- --- ---' | * | 0 | # |   R4'  --- --- ---''   C   C   C'   1   2   3' -----[ I/O Definitions ]-------------------------------------------------TX              PIN     0        ' Transmit Data to Logger   --> 27937.4 (RXD)RX              PIN     1        ' Receive Data from Logger  <-- 27937.5 (TXD)SDA             PIN     8        ' clock - used Sparkfun RTC BOB-00099SCL             PIN     9        ' clock' -----[ Constants ]-------------------------------------------------------Baud            CON     188                  'A baud rate of 4800DS1307          CON     %1101 <<4> 510)THEN start = 0  LOOP UNTIL (IN3 = 0)              ' wait for key  key = ~KeyPad   ' get inverted state of bits  IF (start <510>26 THEN    GOSUB ValidCode  ELSEIF clock(2)>6 AND clock(2)<22 THEN    GOSUB ValidCode  ELSE    Note = "Z":GOSUB InvalidCode   ' set note for timezone denial  ENDIFRETURN' -----[ InvalidCode ]----------------------------------------------------InvalidCode:  GOSUB Beep2  GOSUB Beep2  GOSUB Beep2  GOSUB History  GOSUB Main' -----[ ValidCode ]----------------------------------------------------ValidCode:  Note = "G"            'set note to 1 for access granted  HIGH 12               'send signal to open latch  GOSUB Beep2  GOSUB Beep  PAUSE 2500            'delay to keep latch open  LOW 12                'send signal to close latch  GOSUB Beep2  GOSUB History  GOSUB Main' -----[ History ]----------------------------------------------------History:             'this info goes into a history log on logger GOSUB Check_Logger SEROUT TX, Baud, [$01, $20, "Log.txt", $0D]            ' DIR  SERIN RX, Baud, 500, No_Log,[WAIT($20)]         ' Wait for $20 or time out if no response  SEROUT TX,Baud,[$9,$20,"Log.txt", CR]  SERIN RX,Baud,500, LogErr2,[WAIT(">")]  SEROUT TX,Baud,[$8,$20,$0,$0,$0,DEC 24,CR,DEC2 Apt," ",DEC4 keycode,                     " ", Note," ",                     HEX2 clock(2),":",HEX2 clock(1)," ",                     HEX2 clock(6),HEX2 clock(5),HEX2 clock(4),CR,$0A,CR]  SERIN RX,Baud,500, LogErr3,[WAIT(">")]  SEROUT TX,Baud,[$0A,$20,"Log.txt", CR]  SERIN RX,Baud,500, LogCloseErr,[WAIT(">")]DEBUG CR,? Apt, ? keycode, ASC ? Note    'this data went to History LogDEBUG HEX2 clock(2), ":", HEX2 clock(1), ":", HEX2 clock(0), CRDEBUG "20", HEX2 clock(6), "-", HEX2 clock(5), "-", HEX2 clock(4), CRRETURN'-----[ Logger Error checks for Log file]-----------------------------------------------LogErr2:   Note = "M"   GOSUB InvalidCodeLogErr3:   Note = "N"   GOSUB InvalidCodeLogCloseErr:   Note = "P"   SEROUT TX,Baud,[$0A,$20,"Log.txt", CR]   GOSUB InvalidCodeNo_Log:  SEROUT TX,Baud,[$9,$20,"Log2.txt", CR]      ' create second log file if log is corrupted  SERIN RX,Baud,500, LogErr2,[WAIT(">")]  SEROUT TX,Baud,[$8,$20,$0,$0,$0,DEC 24,CR,DEC2 Apt," ",DEC4 keycode,                     " ", Note," ",                     HEX2 clock(2),":",HEX2 clock(1)," ",                     HEX2 clock(6),HEX2 clock(5),HEX2 clock(4),CR,$0A,CR]  SERIN RX,Baud,500, LogErr3,[WAIT(">")]  SEROUT TX,Baud,[$0A,$20,"Log2.txt", CR]  SERIN RX,Baud,500, LogCloseErr,[WAIT(">")]  GOSUB Main' -----[ Use Keypad to Update Clock ]----------------------------------------------------KP_Clock_Update:  GOSUB Beep         ' 4 beeps for ready for time and date entry  GOSUB Beep  GOSUB Beep  GOSUB Beep  GOSUB GetKeyPad  IF keyIn <>4 THEN GOSUB InvalidCode    'sub password  GOSUB Beep  GOSUB Beep2  counter = 12DO  GOSUB GetKeyPad    counter = counter - 1    kpEntry(counter) = keyInLOOP UNTIL counter = 1  clock(1) = kpEntry(2) * 10 + kpEntry(1)     clock(1) = clock(1) // 60            'update mins     clock(1) = (clock(1) / 10 << 4) + (clock(1) // 10)'decimal to BCD  clock(2) = kpEntry(4) * 10 + kpEntry(3)     clock(2) = clock(2) // 24            'update hours     clock(2) = (clock(2) / 10 << 4) + (clock(2) // 10)'decimal to BCD  clock(3) = kpEntry(5)     clock(3) = clock(3) // 7            'update day of week     clock(3) = (clock(3) / 10 << 4) + (clock(3) // 10)'decimal to BCD  clock(4) = kpEntry(7) * 10 + kpEntry(6)     clock(4) = clock(4) // 31            'update day of month     clock(4) = (clock(4) / 10 << 4) + (clock(4) // 10)'decimal to BCD  clock(5) = kpEntry(9) * 10 + kpEntry(8)     clock(5) = clock(5) // 12            'update month     clock(5) = (clock(5) / 10 << 4) + (clock(5) // 10)'decimal to BCD  clock(6) = kpEntry(11) * 10 + kpEntry(10)     clock(6) = (clock(6) / 10 << 4) + (clock(6) // 10)'decimal to BCD  clock(0) = $00  clock(7) = 0  GOSUB Set_Clock  GOSUB Get_Clock  DEBUG CR, HEX2 clock(2), ":", HEX2 clock(1), ":", HEX2 clock(0), CR  DEBUG ? clock(3), CR  DEBUG "20", HEX2 clock(6), "-", HEX2 clock(5), "-", HEX2 clock(4), CRRETURN' --------[ I2C Clock Subroutines ] ----------------Set_Clock: PAUSE 100 I2COUT SDA, DS1307, 0, [STR clock\8]           ' update clock registersRETURNGet_Clock:  PAUSE 100                           ' wait 100 ms  CHANGE IF MORE CODE IS ADDED !!!  I2CIN SDA, DS1307, 0, [STR clock\8]  ' retrieve clock registersRETURN' --------[ Beeps ] ----------------Beep:  HIGH 14                'beep for ready  PAUSE 200  LOW 14  PAUSE 100RETURNBeep2:  HIGH 14                'beep for ready  PAUSE 200  LOW 14  PAUSE 200RETURN'------------(  Code Update )----------------------------------Code_Update:  GOSUB Beep         ' 2 beeps for ready for Code update  GOSUB Beep  GOSUB GetKeyPad  IF keyIn =2 THEN GOSUB Add_Code ELSEIF keyIn = 3 THEN GOSUB Delete_Code ELSE GOSUB InvalidCode  RETURN' --------[ Add PassCode ] ----------------Add_Code:  GOSUB Code_Loop  GOSUB Check_Logger  SEROUT TX,Baud,[$9,$20, DEC4 keycode, CR] ' creates file  SERIN RX,Baud,500, LogErr2,[WAIT(">")]  SEROUT TX,Baud,[$8,$20,$0,$0,$0,DEC 2,CR,DEC2 Apt,CR] 'writes Apt no to file  SERIN RX,Baud,500, LogErr3,[WAIT(">")]  GOSUB Close_Logger  GOSUB Beep  GOSUB Beep  DEBUG CR,? Apt, ? keycodeRETURN' --------[ Delete PassCode ] ----------------Delete_Code:  GOSUB Code_Loop  GOSUB Check_Logger SEROUT TX,Baud,[$07,$20,DEC4 keycode,CR]  'deletes file SERIN RX,Baud,500,DeleteErr,[WAIT(">")]  GOSUB Beep  GOSUB Beep  DEBUG ? keycode, CRRETURNDeleteErr:   DEBUG "file delete error", CR   GOSUB InvalidCode' --------[ Loop for Code Input ] ----------------Code_Loop:GOSUB Beep   counter = 0   keycode = 0DO  GOSUB GetKeyPad    counter = counter + 1    kpEntry(counter) = keyInLOOP UNTIL counter = 6    keycode = kpEntry(1) * 10    keycode = keycode + kpEntry(2)    keycode = keycode * 10    keycode = keycode + kpEntry(3)    keycode = keycode * 10    keycode = keycode + kpEntry(4)    Apt = kpEntry(5) * 10    Apt = Apt + kpEntry(6)RETURN' --------[ Check Logger ] ----------------Check_Logger: PAUSE 100                              ' Allow Time To Settle SEROUT TX, Baud, [CR] SERIN RX,Baud,500,Not_Found2,[WAIT(">")]RETURNNot_Found2:  Note = 2  GOSUB InvalidCode' --------[ Clear Variables ] ----------------Clear_Variables:   counter = 0   key = 0   keyIn = 0   Apt = 0   Note = 0   start(1) = 0   keycode = 0   HIGH 2              ' shut logger power offRETURN

Statistics: Posted by danner — Wed Mar 17, 2010 8:41 am


]]>
2010-03-17T04:42:39-05:00 2010-03-17T04:42:39-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=20525#p20525 <![CDATA[INP and OUT Port]]>
Apparently you also got the beeper to work. What changes did you make?

Can I get a piece of the action? 8)

Ted

In loving memory of Mac who owned the Network 54 Qbasic Forum until his untimely death!

Statistics: Posted by burger2227 — Wed Mar 17, 2010 4:42 am


]]>
2010-02-24T16:50:38-05:00 2010-02-24T16:50:38-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=20469#p20469 <![CDATA[Project]]>
Danner

Statistics: Posted by danner — Wed Feb 24, 2010 4:50 pm


]]>
2008-11-21T01:53:28-05:00 2008-11-21T01:53:28-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=18345#p18345 <![CDATA[INP and OUT Port]]>
Ted

Statistics: Posted by burger2227 — Fri Nov 21, 2008 1:53 am


]]>
2008-06-17T09:27:20-05:00 2008-06-17T09:27:20-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=17316#p17316 <![CDATA[Thanks for posting]]>
I learned a lot on this project.

Take care,

Danner

Statistics: Posted by danner — Tue Jun 17, 2008 9:27 am


]]>
2008-06-17T08:39:32-05:00 2008-06-17T08:39:32-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=17314#p17314 <![CDATA[INP and OUT Port]]>
Image

EDIT Added the following part/location list for the PCB above:

Code:

PCB ? RS 276-170 COMPONENT          PCB LOCATION     COMPONENT  PCB LOCATION------------------ ------------     ---------- ------------  Resistors                           Red Wires 4.7 KOhm           Y44 ? I42                   A45 ? X45 4.7 KOhm           Y43 ? I41                   A44 ? X44 4.7 KOhm           Y41 ? J40                   I43 ? X38 4.7 KOhm           Y39 ? J39                   F10 ? X10   1 KOhm           Y37 ? J37                    G7 ? G10 330 Ohm            H27 ? E29                   I10 ? I19 330 Ohm            H25 ? E27                   J10 ? J15 330 Ohm            H23 ? E25       Black Wires 330 Ohm            H21 ? E23                   B43 ? F38 4.7 KOhm           C21 ? D20                   E31 ? H37 4.7 KOhm           C17 ? D16                   J38 ? Y38 2.2 KOhm           H18 ? I17                    J4 ? Y5 2.2 KOhm           H14 ? H12 2.2 KOhm           F13 ? E8        CoralDiodes                              Row         C23 ? C42 1N4001              C6 ? C4        Row         D25 ? D41 1N4001              G6 ? I7        Row         C27 ? C40 Optocoupler                         Row         D29 ? D39 Mouser 512-4N3     E20 ? F20       Pin 11      E33 ? H46 Mouser 512-4N32    E16 ? F16       Column      H31 ? I39 Encoder Chip                        Column      H33 ? H40 EDE1144            E47 ? F47       Column      G35 ? H41Jameco 171969 Transistor                          Base wire    J5 ? J17 NPN RS 276-1617    Emit. G11 ? G13 NPN RS 276-1617    Emit. I4 ? I6   Yellow Wires Relay                                            Pwr sply ? c2 5VDC RS 275-240    Coil F6 ? F7                 D2 ? D4 Crystal                                          Gray Wires DigiKey 445-1638ND H44 ? J45                    Pwr Gnd ? I2                                                 H2 ? H11                                     Terminals    RS 276-1388

Statistics: Posted by MystikShadows — Tue Jun 17, 2008 8:39 am


]]>
2008-06-16T20:08:37-05:00 2008-06-16T20:08:37-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=17313#p17313 <![CDATA[INP and OUT Port]]> ...lol.

and yeah, I like that signature ;-)

Statistics: Posted by MystikShadows — Mon Jun 16, 2008 8:08 pm


]]>
2008-06-16T19:38:31-05:00 2008-06-16T19:38:31-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=17312#p17312 <![CDATA[hmmmmmmmm]]>
Myst, wish you had an email address here. Note my Signature also (teehee)

Pleasure to help Dan! My VB code is not gonna work in .NET and you would also have to figure out the form controls used. VB6 can also use Control Arrays which I used for the Port bit checkboxes. That is why I never sent you the code.

Ted

Statistics: Posted by burger2227 — Mon Jun 16, 2008 7:38 pm


]]>
2008-06-16T17:40:53-05:00 2008-06-16T17:40:53-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=17311#p17311 <![CDATA[INP and OUT Port]]> .

I can upload it to my server too if you want to link to it. or forward it to pete so he can upload it to his.

Statistics: Posted by MystikShadows — Mon Jun 16, 2008 5:40 pm


]]>
2008-06-16T14:43:53-05:00 2008-06-16T14:43:53-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=17309#p17309 <![CDATA[Schematic]]>
I looked up to see how to post an image of the schematic as laid out on the PCB but according to the FAQ's I would have to have it posted on a server somewhere and link to it. I don't have that so... if anyone wants to see it or get a parts list they can contact me directly through here.



Thanks,
Danner

Statistics: Posted by danner — Mon Jun 16, 2008 2:43 pm


]]>
2008-06-11T15:44:03-05:00 2008-06-11T15:44:03-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=17298#p17298 <![CDATA[Dan Fuller's final code]]>

Code:

'  File...   Door Program 'Author....   Dan Fuller 'E-Mail....   qxotic@hotmail.com 'Started...   14 Nov. 2007  finished 14 Feb. 2008 'Description - to accept 4 digit code from keypad connected to LPT1, '              check code against database, if code is valid at the time '              send signal to electronic strike to allow acess and then '              log event in history. '---- INITIALIZATION ----- CLS temp$ = " " Tt$ = TIME$ Td$ = DATE$ Hour$ = MID$(TIME$, 1, 2) Apt = 0 CODE = 1000 TimeZone = 0 Note$ = "T" '*********************************** '*              MAIN               * '*********************************** DO    IF INKEY$ = CHR$(27) THEN         PRINT "Main Sub Exit"         SYSTEM    END IF         GOSUB AcceptInput         GOSUB EvaluateInput         GOSUB LogHistory LOOP END '*********************************** '*         AcceptInput             * '*********************************** AcceptInput:    flag = 0: count = 0: keycode = 0: keypress = 0: status = 0 DO    IF INKEY$ = CHR$(27) THEN         PRINT "AcceptInput exit"         SYSTEM    END IF    status = INP(889)       IF status >= 128 THEN        flag = 1: start = TIMER: count = count + 1          IF status < 152 THEN keypress = ((status - 120) / 8)          IF status > 152 AND status < 184 THEN keypress = ((status - 128) / 8)          IF status > 184 AND status < 216 THEN keypress = ((status - 136) / 8)          IF status = 232 THEN keypress = 0          IF status = 240 THEN EXIT DO       '# key exits Input check          keycode = keycode + keypress          IF count < 4 THEN keycode = keycode * 10 'assumes no zero first    END IF          TIMER < start THEN start = start - 86400     IF flag = 1 AND TIMER > start + 5 THEN          count = 0: keycode = 0          EXIT DO    END IF      'prevent single entry accepted more then once     DO: status = INP(889)     LOOP UNTIL status = 0  'PRINT keycode, keypress, count, status 'used during testing LOOP UNTIL count = 4 RETURN '*********************************** '*         EvaluateInput           * '*********************************** EvaluateInput:     DBCode = 9998 OPEN "userdb.dat" FOR INPUT AS #1         DO WHILE NOT EOF(1)           INPUT #1, Apt, DBCode, TimeZone, Note$              IF DBCode = 9999 THEN GOSUB InvalidCode           IF DBCode = keycode THEN EXIT DO         LOOP      CLOSE         IF TimeZone = 1 THEN GOSUB TimeCheck         IF DBCode < 9998 AND TimeZone < 5 THEN GOSUB ValidCode RETURN '*********************************** '*         InvalidCode             * '*********************************** InvalidCode:    ' edit code to send an error signal beep if desired         'PRINT "The Code "; keycode; "was invalid" 'used during testing only         'PRINT Tt$; Td$         'INPUT temp$ RETURN '*********************************** '*     ValidCode-Door Unlock       * '*********************************** ValidCode:         'PRINT "The Code "; keycode; "was GOOD" 'used during testing only         'PRINT Tt$; Td$          OUT 890, INP(890) XOR 8  'door unlock    RETURN '*********************************** '*         LogHistory              * '*********************************** LogHistory:         OPEN "History.DAT" FOR APPEND AS #2           WRITE #2, Apt, CODE, TimeZone, Tt$, Td$, Note$         CLOSE #2 RETURN 'below is data example of password file 'DATA Apt  Code   Time Zone  Note 'DATA   01, 1001,   1,        Ten 'DATA   02, 1002,   1,        Ten 'DATA   03, 1003,   1,        Ten 'DATA   04, 1004,   1,        Ten 'DATA   44, 4444,   4,        Emp 'DATA   99, 9999,   4,        End File 

There are other ways to do this code. For one, you could add LED's to indicate access using the other Control pins C0 and C1. To just change one control pin value, you can send the pin total needed at the time instead of using XOR as above. Get PortTalk for NT or XP machines!

I have also created a program in VB6 to use in Windows. The only major problem is trying to use the peizo speaker from the chip to indicate keypad entries. It messed up the other chip data sent.

Ted

Statistics: Posted by burger2227 — Wed Jun 11, 2008 3:44 pm


]]>
2008-01-25T11:01:54-05:00 2008-01-25T11:01:54-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16475#p16475 <![CDATA[Update]]>
The computer now receives and processes keypad input properly.

To Ted.. I have not been home to see if you have responded to that email yet. My questions after review and using the E=IR formula.. the Relay is 5V with a 56 Ohm R to its coil and will take 89 mA so I am assuming I do not need much of a resistor in that circuit if any.

On the latch.. for a buzzer I am thinking of trying that speaker that did not work well on the controller chip.. it says it is 4-28V DC.. and after holding the Ohm meter on it for some time.. it leveled off at around 14 Ohms R. The latch is 12V and .332 amps with a Coil R of 34.6 Ohms so I do need to add a little R to that circuit.. maybe the speaker will be just right?

Once I have these bugs worked out and the code touched up I will post it.

Thank you Ted!
Danner

Statistics: Posted by danner — Fri Jan 25, 2008 11:01 am


]]>
2008-01-08T02:44:39-05:00 2008-01-08T02:44:39-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16284#p16284 <![CDATA[INP and OUT Port]]>
It worked at Gmail ..........hooray!

Statistics: Posted by burger2227 — Tue Jan 08, 2008 2:44 am


]]>
2008-01-07T14:38:09-05:00 2008-01-07T14:38:09-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16270#p16270 <![CDATA[mail]]>
That is odd. In the last week I know I have tried to mail you from 3 different addresses. Only the Yahoo address has shown that it was not deliverable. These were all to the comcast address you gave me. I did get the email from you at my yahoo address.

I will try to get the circuit tested on the other computer I put together.. using the resonator and 1K resistor changes... I'll update you as soon as I learn anything. I do know it is showing 120 as it should in your port monitor program. I made sure to get that loaded and tested before I hooked anything up.

Will update you in the next day or two.

Thank you,
Daniel

Statistics: Posted by danner — Mon Jan 07, 2008 2:38 pm


]]>
2008-01-07T12:05:53-05:00 2008-01-07T12:05:53-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16255#p16255 <![CDATA[INP and OUT Port]]> Statistics: Posted by burger2227 — Mon Jan 07, 2008 12:05 pm


]]>