1 Attachment(s)
16F877 and 4094 please help
Hello friends
I have manufactured this circuit with 16F877
3 switches of entry that them portray the situation of entry in the 4094
This code work good .my problem is always sees the last entry
that I can see the all entries simultaneously be portrayed in the 4094
Code:
INCLUDE "modedefs.bas"
DEFINE SHIFT_PAUSEUS 100
TRISB = %00000111
alarm var word
'****************************************************************
symbol clock=portc.4
symbol data_pin=portc.2
symbol strb=PORTc.3
'****************************************************************
alarm=0
start:
IF PORTB.0=0 THEN
alarm=%10000000
ENDIF
IF PORTB.1=0 THEN
alarm=01000000
ENDIF
IF PORTB.2=0 THEN
alarm=%00100000
ENDIF
gosub print
goto start
print:
ShiftOut data_pin,clock,0,[alarm]
strb = 1 : PAUSEUS 100 : STRB = 0
return
end
1 Attachment(s)
Re: 16F877 and 4094 please help
Hi,
I am inexperienced still in picbasic but I try
Reading her user guide, and studying examples of code
I noticed in this post the code from aratti, It is exactly what I need (thank you very much aratti)
I used him as a basis, and I made changes so that him I adapt in my work
Here I would want your help, so that I use also port C from the 16F876, so that I increase the inputs (push button) circuit in 16
Thank you in advance
regards
Here it is the code and the circuit, that works perfect
Code:
DEFINE OSC 10
DEFINE SHIFT_PAUSEUS 100
TRISA = %00000000
TRISB = %11111111
TRISC = %00000000
ADCON1 = 7
'************************************
alarm var BYTE
Flag var BYTE
bleg var word
B0 var word
'************************************
Symbol data_pin=PORTA.0
Symbol clock=PORTA.1
Symbol strb=PORTA.2
Symbol oe=PORTA.3
'************************************
alarm=0
Flag = 0
B0 = 0
bleg= 900
portC = %00000000
'************************************
start:
oe= 0:pause bleg
B0 = PortB & %11111111
Alarm = (0 + B0) * 1
If Alarm <> Flag then gosub Print
oe= 1:pause bleg
goto start
'************************************
Print:
ShiftOut data_pin,clock,1,[alarm]
strb = 1 : PAUSEUS 100 : STRB = 0
Flag = Alarm
return
end
Attachment 7346
Re: 16F877 and 4094 please help
Hi Anatoli
I am not guru in picbasic I will try to help you, with those who I know
It tryed these changes
Code:
DEFINE OSC 10
DEFINE SHIFT_PAUSEUS 100
TRISA = %00000000
TRISB = %11111111
TRISC = %11111111
alarm var word
Flag var BYTE
bleg var word
B0 var word
C0 var word
'************************************
Symbol data_pin=PORTA.0
Symbol clock=PORTA.1
Symbol strb=PORTA.2
Symbol oe=PORTA.3
'************************************
alarm=0
Flag = 0
B0 = 0
C0 = 0
bleg= 500
portC = %00000000
ADCON1 = 7
'************************************
start:
oe= 0:pause bleg
B0 = PortB & %11111111
C0 = PortC & %11111111
Alarm = (0 + C0) * 1 & Alarm = (0 + B0)
If Alarm <> Flag then gosub Print
oe= 1:pause bleg
goto start
'************************************
Print:
ShiftOut data_pin,clock,1,[alarm\8]
strb = 1 : PAUSEUS 100 : STRB = 0
Flag = Alarm
return
end
Re: 16F877 and 4094 please help
Hi dovegroup
I thank you for your help, him I tryed
the second IC-4094 works rightly, but the first IC-4094 does not works any output
Re: 16F877 and 4094 please help
It looks like you're using Proteus and simulating the project. If so, and maybe not, you've assigned D9 to two chips which I'm assuming are the 4094. Change one or the other to something else and hook something up to the lower chip. Then see what you've got.
1 Attachment(s)
Re: 16F877 and 4094 please help
Friends Dovegroup and AvionicsMaster1
Connecting a logic analyzer in line CLOCK and DATA
I discovered that the DATA that are directed to the IC-4094 are only 8bit, would not be supposed were 16bit
8bit for the first IC and 8bit for the second IC
See the snapshot from the analyzer
Attachment 7347
Re: 16F877 and 4094 please help
Very rightly Aнатолий
8bit for the first 4094 and 8bit for the second 4094
I do not know to answer you how it will become this, I suppose that thus
ShiftOut data_pin,clock,1,[alarm_1,alarm_2]
Re: 16F877 and 4094 please help
I will try with this
Thank you .Я благодарю товарища
1 Attachment(s)
Re: 16F877 and 4094 please help
Товарища dovegroup
Even if you are not guru in the picbasic as you report in initial your post
Your help was very big, so that I complete my work
See the changes that I made
Alarma = (0 + C0) * 1
Alarme = (0 + B0) * 1
ShiftOut data_pin,clock,1,[Alarma,Alarme]
Thank you very much
Aнатолий (Anatoli)
Attachment 7348
Re: 16F877 and 4094 please help
Anatoli good the knowledge guru my friend, but when doesn't exist appetite in order to you help ?
I am cheerful that I even helped little So that you will complete your work
привет товарищ Анатолий
алексей или иным dovegroup