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.

What am I doing wrong?

Status
Not open for further replies.

Trevors

New Member
Hello everybody,
I have a 16F84A connected to 2 4514's (4 to 16 decoder) RA0 and RA1 are connected to the INHIBIT lines. RB1,RB2,RB3 and RB4 are connected to the 4514's inputs. I am trying to test the circuit by simply flashing the outputs in sequence. I only require 18 outputs (S0 to S15 of first 4514 and S0 to S1 of second 4514. I've managed to get the outputs to cycle but after the first run, S1 of the first 4514 flashes and then the sequence starts from S0 as it should. I cannot figure out why this is happening. HELP Pleeeeze!
 

Attachments

  • Electro.asm
    3.6 KB · Views: 143
What I understand is you need 18 outputs.The first 16 outputs taking from first 4514 & the next two is from next 4514.

I must tell you write your 4 bit inputs in the binary fashion something like this.
Code:
movlw	b'0000'
movwf	PORTB		;s0
call	Delay
movlw	b'0001'
movwf	PORTB		;s1
call	Delay
 
Last edited:
Gayan Soyza said:
What I understand is you need 18 outputs.The first 16 outputs taking from first 4514 & the next two is from next 4514.

I must tell you write your 4 bit inputs in the binary fashion something like this.
Code:
movlw	b'0000'
movwf	PORTB		;s0
call	Delay
movlw	b'0001'
movwf	PORTB		;s1
call	Delay

Hi Gayan,
He is using PORTB pins 1,2,3,4 to drive the 4514's , not 0,1,2,3..:)
 
hi Trevor,
Try this modified version of your program.

I have deleted the delays so that I could run the program thru my Oshonsoft simulator. Just put the delay calls back in where indicated.

Lets know how it goes.

EDIT:
If you had chosen PORTB 0,1,2,3 you would be able write a simpler program.:rolleyes:
 
Last edited:
Hi Eric,
Got a similar problem with this code as well.Now S0 of the 2nd 4514 flashes once after the full sequence is complete and then the sequence begins again. I would have used RB0,1,2,3 but my original design had an inverter between the 2 4514's so I could select between them with one pin. Unfortunately, I forgot that when all inputs are low, S0 is high. So I removed the inverter and because I've already designed the layout and just waiting for the finished board, I opted to leave the connections on port b the same and use port a for enabling. Anyway, I figured out whats wrong. After the sequence is complete, Port B still has the last value loaded in it, so when I switch back from the 2nd 4514 to the 1st, that output is immediately high. I'll have to find a way around this. What I actually want is to have the outputs switch on in a specific sequence, not necessarily 'chase'. I just did this to test.
Txs for the help
 
hi Trevor.

; end of 4514 #1
MOVLW 00
MOVWF PORTB ;blank #1
CALL Delay;no delay;;; add this delay

Its runs OK in the Oshonsoft simulator.??
 
Hi Guys,
That still didn't solve the problem. Not sure howcome it runs ok on the sim. Problem is that even if you write 00 to portb, as long as one of the inhibits are low, S0 will be high. After some head scratching, I got it working. Code attached.
Txs again for your help
 

Attachments

  • Electro4.asm
    3.6 KB · Views: 127
Trevors said:
Hi Guys,
That still didn't solve the problem. Not sure howcome it runs ok on the sim. Problem is that even if you write 00 to portb, as long as one of the inhibits are low, S0 will be high. After some head scratching, I got it working. Code attached.
Txs again for your help

hi Trevor,
Goto www.oshonsoft.com and download the 'trial' version of the PICsimulator.
IIRC its about 30days or 30 startups.

Give it a try, lets know what you find.

I'll run your latest asm again, get back to you.;)

EDIT: which assembler are you using.???
 
Txs
Will look at it now. I'm using MPLAB v8.0
 
Trevors said:
Txs
Will look at it now. I'm using MPLAB v8.0

hi Trevor,

Run your program OK, I see that you have added a 4514 Select '0'.

Reason I asked about the assembler is that you used 04, 05 for PORTA and PORTB, rather than the 'name' in your original program.

If you look here on your hard drive:
C:\Program Files\Microchip\MPASM Suite\Template\Code
You find templates written by microchip
eg:
16F84ATEMP.ASM

Use these templates as starting point for you program writing.:)
 
Found it. Don't understand everything in there but will get more familiar with it.
Txs Eric
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top