![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Experienced 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!
__________________
"Better to have tried and failed, than to have failed to try" |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
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
__________________
Gayan Forum Supporter Last edited by Gayan Soyza; 16th April 2008 at 10:54 AM. |
|
|
|
|
|
(permalink) | |
|
Experienced Member
|
Quote:
He is using PORTB pins 1,2,3,4 to drive the 4514's , not 0,1,2,3..
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
|
|
|
|
|
|
(permalink) |
|
Experienced Member
|
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.
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 7th July 2008 at 11:23 AM. |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
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
__________________
"Better to have tried and failed, than to have failed to try" |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
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.??
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
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
__________________
"Better to have tried and failed, than to have failed to try" |
|
|
|
|
|
(permalink) | |
|
Experienced Member
|
Quote:
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.???
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
|
|
|
|
|
|
(permalink) |
|
Experienced Member
|
Txs
Will look at it now. I'm using MPLAB v8.0
__________________
"Better to have tried and failed, than to have failed to try" |
|
|
|
|
|
(permalink) | |
|
Experienced Member
|
Quote:
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.
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
|
|
|
|
|
|
(permalink) |
|
Experienced Member
|
Found it. Don't understand everything in there but will get more familiar with it.
Txs Eric
__________________
"Better to have tried and failed, than to have failed to try" |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| AM receiver | raj_404 | General Electronics Chat | 61 | 11th July 2008 02:41 AM |
| Am I wrong? | Boncuk | General Electronics Chat | 15 | 12th April 2008 04:33 PM |
| What am i doing wrong? First project | Zordon | Micro Controllers | 5 | 31st March 2008 05:50 PM |
| Am I USING PIC UART CORRECTLY?? | cyprio7 | Micro Controllers | 46 | 15th January 2008 06:02 PM |
| serial communication code,whats wrong in this? | baftab | Micro Controllers | 4 | 20th December 2007 01:02 AM |