News:

;) This forum is the property of Proton software developers

Main Menu

3 actions and two inputs

Started by Marcel_741, Feb 22, 2024, 08:01 PM

Previous topic - Next topic

Marcel_741

xvovanx

Thanks for the feedback, and good to hear it works for you.

Frizie

You are absolute correct and in the blindness off trying to get it work, I now and then forget these logic way of working. But it is good to maintain overview in smaller pieces.

Stephen Moss

Big story and I have to read it well. I will let it sink and try to complete your meaning in my words. The point of the NOR port is off course correct. The lack of HIGH inputs in rest situation should be an high output. The other 3 situation are correct and gives a LOW.

Thanks all




trastikata

Hello,

I;d assume all button have pull-up resistors?

Another thing I noticed is the lack of button de-bouncing in software, is there any kind of in hardware?

ken_k

If one wanted 80 buttons on three pins this might be a good solution.

https://www.ti.com/lit/ds/symlink/tca8418e.pdf?ts=1709161798239&ref_url=https%253A%252F%252Fwww.google.com%252F

TCA8418E

The TCA8418E is a keypad scan device with
10-Byte FIFO to Store 10 Key Presses.

Marcel_741

#23
trastikata

As the test been done, I noticed no floating inputs with a unstable reaction from the chips. In this case it means dat "0" was "0" and "1"was "1". The way the pushbuttons are used, a repeat of a "1" is not a problem. It takes an action on the high, even if a couple of 1's follows. Up till now, no issues.

Thank for the feedback

Ken_K

The number of input is solved. Thanks for the input and idea.

I am gonna do some test from a other angle. I add the drawing how the end result should be. Remark is that the IC's (CMOS) will be become 14/16 sockets, to place the one to test.

Regards,

Marcel

Drawing corrected.(LED were wrong)

trastikata

Are those LEDs supposed to be reverse biased?

Marcel_741


Marcel_741

Hello,

As I was searching for a way to create enough I/O, I came to a solution. Using the PCF8574 gave a lot of space and be able to use the PIC16F628A for all the intentions. As I was programming the word space on the PIC became more and more to 100%. This is a new phase to face, as I never got so far in a programming. The programm is add and I am wondering if there is more cluster the jobs to do, to save words. Or is it a matter of using an other PIC. There are some double used command in different routines, but that's how it went.

Regards,

Marcel
'****************************************************************
'*  Name    : CMOS_tester 2024.BAS                              *
'*  Author  : Marcel Alkema                                     *
'*  Notice  : Copyright (c) 2024 Marcel Alkema                  *
'*          : All Rights Reserved                               *
'*  Date    : 11-3-2024                                         *
'*  Version : 1.0                                               *
'*  Notes   : TEST ALL PORT OF CMOS DEVICES CD4001/CD4011       *
'*          : CD/4071/CD4081/CD4093/CD4069/CD4043/CD4044        *
'****************************************************************

Device 16F628A                     ;USED IS THE 16F628A
 
Config INTRC_OSC_NOCLKOUT,_
       WDT_OFF,_
       PWRTE_ON,_
       LVP_OFF,_
       MCLRE_OFF

      All_Digital TRUE             ;ALL INPUTS DIGITAL
      Xtal =4

 Symbol POWER = PORTA.1            ; PORTA.1 called POWER(Systeem "0nn)
 
 Symbol START = PORTA.2            ; PORTA.2 called START (Cyclus start)
 Symbol KLAAR = PORTA.3            ; PORTA.3 called KLAAR (Cyclus stop)

 Symbol sw1 = PORTA.7              ; PORTA.7 called SW1 (Enter)
 Symbol sw2 = PORTA.6              ; PORTA.6 called SW2 (Down)
 Symbol sw3 = PORTA.5              ; PORTA.5 called SW3 (Up)
 
 Dim TELLER As Byte
 Dim tel_BIT As Bit

 Declare SDA_Pin PORTB.1
 Declare SCL_Pin PORTB.0
 
 Clear
 
 DelayMS 500
 Cls
 While 1 = 1
 High POWER
 High KLAAR
 TELLER = 1
   
 Print At 1,1,"MENU KEUS = ", Dec2 TELLER                 
 
 RUN:
 If TELLER = 1 Then Print At 2,1, "TEST CMOS CD4001"
 If TELLER = 2 Then Print At 2,1, "TEST CMOS CD4011"
 If TELLER = 3 Then Print At 2,1, "TEST CMOS CD4071"
 If TELLER = 4 Then Print At 2,1, "TEST CMOS CD4081"
 If TELLER = 5 Then Print At 2,1, "TEST CMOS CD4093"
 If TELLER = 6 Then Print At 2,1, "TEST CMOS CD4069"
 If TELLER = 7 Then Print At 2,1, "TEST CMOS CD4043"
 If TELLER = 8 Then Print At 2,1, "TEST CMOS CD4044"
   
 If TELLER <6 And sw1= 1 Then
 
 Low KLAAR
 High START
 
 BStart
 DelayMS 1000
 Print At 1,1,"PCF8574 ID 000  "
 DelayMS 5000
 BusOut %01000000 ;Call on PCF8574 (A0:0/A1:0/A2:0)
 DelayMS 5000
 
 'POORT 1 testen
 Print At 1,1,"INPUT 1 = HIGH  "
 BusOut %11111110
 DelayMS 5000
 Print At 1,1,"INPUT 1 = LOW   "
 BusOut %11111111 ;All inputs "0"
 DelayMS 5000
 Print At 1,1,"INPUT 2 = HIGH  "
 BusOut %11111101
 DelayMS 5000
 Print At 1,1,"INPUT 2 = LOW   "
 BusOut %11111111 ;All inputs "0"
 DelayMS 5000
 Print At 1,1,"INPUT 1&2 HIGH  "
 BusOut %11111110
 BusOut %11111101
 DelayMS 5000
 BusOut %11111111 ;All inputs "0"
 Print At 1,1,"INPUT 1&2 LOW   "
 BusOut %11111111
 DelayMS 5000
 
'POORT 2 testen
 Print At 1,1,"INPUT 3 = HIGH  "
 BusOut %11111011
 DelayMS 5000
 Print At 1,1,"INPUT 3 = LOW   "
 BusOut %11111111 ;All inputs "0"
 DelayMS 5000
 Print At 1,1,"INPUT 4 = HIGH  "
 BusOut %11110111
 DelayMS 5000
 Print At 1,1,"INPUT 4 = LOW   "
 BusOut %11111111 ;All inputs "0"
 DelayMS 5000
 Print At 1,1,"INPUT 3&4 HIGH  "
 BusOut %11111011
 BusOut %11110111
 DelayMS 5000
 BusOut %11111111 ;All inputs "0"
 Print At 1,1,"INPUT 3&4 LOW   "
 BusOut %11111111
 DelayMS 5000

'POORT 3 testen
 Print At 1,1,"INPUT 5 = HIGH  "
 BusOut %11101111
 DelayMS 5000
 Print At 1,1,"INPUT 5 = LOW   "
 BusOut %11111111 ;All inputs "0"
 DelayMS 5000
 Print At 1,1,"INPUT 6 = HIGH  "
 BusOut %11011111
 DelayMS 5000
 Print At 1,1,"INPUT 6 = LOW   "
 BusOut %11111111 ;All inputs "0"
 DelayMS 5000
  Print At 1,1,"INPUT 5&6 HIGH  "
 BusOut %11101111
 BusOut %11011111
 DelayMS 5000
 BusOut %11111111 ;All inputs "0"
 Print At 1,1,"INPUT 5&6 LOW   "
 BusOut %11111111
 DelayMS 5000
 
 'POORT 4 testen
 Print At 1,1,"INPUT 7 = HIGH  "
 BusOut %10111111
 DelayMS 5000
 Print At 1,1,"INPUT 7 = LOW   "
 BusOut %11111111 ;All inputs "0"
 DelayMS 5000
 Print At 1,1,"INPUT 8 = HIGH  "
 BusOut %01111111
 DelayMS 5000
 Print At 1,1,"INPUT 8 = LOW   "
 BusOut %11111111 ;All inputs "0"
 DelayMS 5000
 Print At 1,1,"INPUT 7&8 HIGH  "
 BusOut %10111111
 BusOut %01111111
 DelayMS 5000
 BusOut %11111111 ;All inputs "0"
 Print At 1,1,"INPUT 7&8 LOW   "
 BusOut %11111111
 DelayMS 5000
 BStop
 
 High KLAAR
 Low START
 
 Print At 1,1,"MENU KEUS = ",Dec2 TELLER
 
EndIf

    If sw3 = 1 Then
     tel_BIT = 1
      GoSub TEL_PLUS_1
    EndIf
   
    If sw2 = 1 Then
     tel_BIT = 1
      GoSub TEL_AF
    EndIf 
   
GoTo RUN

TEL_PLUS_1:
    If tel_BIT = 1 Then
     TELLER = TELLER + 1
    EndIf
   
     Print At 1,1,"MENU KEUS = ",Dec2 TELLER
           
    tel_BIT = 0
   
    If TELLER > 8 Then
     TELLER = TELLER - 1
    EndIf
   
    If sw3 = 0 Then
     If tel_BIT = 0 Then
      Return
     EndIf
    EndIf
 
GoTo TEL_PLUS_1

TEL_AF:
    If tel_BIT = 1 Then
     TELLER = TELLER - 1
    EndIf
   
     Print At 1,1,"MENU KEUS = ",Dec2 TELLER
         
    tel_BIT = 0
   
    If TELLER = 0 Then
     TELLER = TELLER + 1
    EndIf
   
    If sw2 = 0 Then
     If tel_BIT = 0 Then
    Return
     EndIf
    EndIf
 
GoTo TEL_AF
 
Wend 
End


Dompie

You can replace the very old 16F628A pin compatible with a modern 16F1826 (faster and more options, the same amount of flash and EPROM), but if you take a 16F1827 you have twice as much programming space.

Johan

keytapper

I agreed to step into modern MCU. Many newer MCU still be pin compatible, but feature improved and probably same or less price.
Ignorance comes with a cost