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.

Binary input Hex dispaly (7 segment LED)?

Status
Not open for further replies.
dalmation said:
Nice one, I'll give it a go.

In terms of the ASM files- would I need to do anything other than change the chip name at the top?

You probably don't even need to do that?, a 628 HEX file will load and run in a 627, as long as it only uses the first 1K of memory. The 627 has 1K (like a 16F84) and the 628 has 2K, otherwise they are identical.

But obviously it makes sense to change the name in the assembler file if you're re-assembling it.
 
Excellent- saved a few bucks and learned something! :)


I've finished my PCB design- so off to the fabricators and then a wee wait- and I'll be laughing.

I'll post back when its done to let you all see it.

Thanks again.

-DAlmation.
 
Sorry for the late reply but it seems you've received all the correct answers from the gang.

Say, how 'bout showing us a BMP or JPG screenshot of your layout?

Mike
 
Mike said:
Say, how 'bout showing us a BMP or JPG screenshot of your layout?

Both are REALLY bad suggestions, use either GIF or PNG, much smaller and perfect quality. BMP is perfect but absolutely massive (and isn't a supported format), JPG is poor quality and still far too large.
 
no probs- I'll post a pic when the missus lets me back on the laptop. I'll warn in advance, though- its a very busy design!

I have a powerplane on both sides of the board and 1 on the middle layers (4 layer board). I'll remove them for clarity.

-Dal.
 
The 3D renders of the hex display isnt exactly wonderful- but you get the idea. Board designed with National Instruments "ultiboard".


Image1.jpg

Image2.jpg

Image3.jpg

Image4.jpg

Image5.jpg
 
Mike,
I'm waiting on the PCB's arriving, but in the mean time (for future use) I was having some thoughts...

I currently have 4x 16F628, would it be technically possible to use 2x 16F59 (pinout attached). It has 33 i/o pins. I dont know how the port arrangement affects things.

the 16f59 is really cheap compared to the 628 and I migh be able to get it down to a 2 layer board with the lower component count (half as many IC's, resistors and transistors too).

I know it would be a total reprogram job (and I'm not looking for that), but is it possible?

16F59.PNG

Let me know your thoughts on the subject.

Thanks in advance.

-DAlmation.
 
Mike, K8LH....

You've put in a lot of work to make this project happen for me and I really appreciate it- Thanks go out to you and everyone else who has contributed.

I was hoping you could help me out with one final project problem...

-I have my PCB's and I have built some prototypes.
-I am using Version1 of your ASM (2 and 3 work, but I find 1 suits best).

-I have used 16F627 (not A) chips on the board as some became available to me very cheap. -I assemble your asm, then set my programmer for 627 and choose my config options there)

-The board works great, but it has a slight problem- I have a switch which calls up memory locations for this circuit to read. When switching, under some circumstances something in the PIC crashes the main board, leaving me with no readout (pic circuit carries on, but shows zeroes).

Anyways- I replaced the chips with 16F628A on one board and the problem has completely gone away- I dont fully understand the problem, but that definitely solved it.

When I use the 16F627, I cant enable code protect either and I am pretty sure the gremlins are something to do with me using 628A firmware on a 627 (slightly different commands and configs?)

I tried to edit your ASM for the 627 but I fell flat on my face each time.:confused:


Could I possibly impose and ask you to edit the V1 ASM to match the 16F627?
It is the last hurdle in a very long race, and it would be brilliant!!


Thanks again, mike.

-Dalmation.

EDIT- I have purchased all the 16f627's to complete the project- otherwise I would just use 628A's to solve the problem- sorry to be a pain. I'll take some photos of the PCB/circuit shortly.
 
Last edited:
hi Dalmation.

Just in case Mike is tied up elsewhere, post ALL the program listing you are having problems with, when using the 16F627, I'll have a look thru it.

Unless you would prefer to wait for Mike to respond. :)

Make it an Attachment.
 
hi dalmation,
This is just a copy of the original program without your added features, that is when you are writing to memory with the timer0 interrupt running.
I have modified for a 16F627 it works fine.:)

This program works as it should with a 16F627! as I am sure when I add the intr subr it will also work.

I suspect that you are not disabling the Interrupts when doing a memory read/write, thats possibly why the FULL program sometimes crashes.

Please post the FULL program.:)
 
dalmation said:
When I use the 16F627, I cant enable code protect either and I am pretty sure the gremlins are something to do with me using 628A firmware on a 627 (slightly different commands and configs?)

Yes, the code protection settings are different. The 627 (or 628) has programmable code protection; the 627A (or 628A) allows you to protect the whole program memory or nothing.

The Configuration bits<12,10> CP0 and bits<13,11> CP1 in the PIC16F62X do not exist in the PIC16F627A/628A/648A. They have been replaced with one configuration bit<13> CP.
As a consequence config labels are different:

627/628:

_CP_ALL EQU H'03FF'
_CP_75 EQU H'17FF'
_CP_50 EQU H'2BFF'
_CP_OFF EQU H'3FFF'



627A/628A:

_CP_ON EQU H'1FFF'
_CP_OFF EQU H'3FFF'
 
Hi Dal,

The configuration bits are different between devices so it's usually best to look at the equates in the 16F627.inc file;

Code:
_BODEN_ON                    EQU     H'3FFF'
_BODEN_OFF                   EQU     H'3FBF'
_CP_ALL                      EQU     H'03FF'
_CP_75                       EQU     H'17FF'
_CP_50                       EQU     H'2BFF'
_CP_OFF                      EQU     H'3FFF'
_DATA_CP_ON                  EQU     H'3EFF'
_DATA_CP_OFF                 EQU     H'3FFF'
_PWRTE_OFF                   EQU     H'3FFF'
_PWRTE_ON                    EQU     H'3FF7'
_WDT_ON                      EQU     H'3FFF'
_WDT_OFF                     EQU     H'3FFB'
_LVP_ON                      EQU     H'3FFF'
_LVP_OFF                     EQU     H'3F7F'
_MCLRE_ON                    EQU     H'3FFF'
_MCLRE_OFF                   EQU     H'3FDF'
_ER_OSC_CLKOUT               EQU     H'3FFF'
_ER_OSC_NOCLKOUT             EQU     H'3FFE'
_INTRC_OSC_CLKOUT            EQU     H'3FFD'
_INTRC_OSC_NOCLKOUT          EQU     H'3FFC'
_EXTCLK_OSC                  EQU     H'3FEF'
_LP_OSC                      EQU     H'3FEC'
_XT_OSC                      EQU     H'3FED'
_HS_OSC                      EQU     H'3FEE'
I'm sure one of us can make a 16F627(non-A) version of the program for you. Hang in there. It's "Turkey Day" so we're tied up most of the day.

Is this what you need?

(1) 16F627 version 1 Source?
(2) BOR/BOD disabled?
(3) WDT enabled?
(4) Code protection on?

Regards, Mike
 
Hey Dal,

I've never used the watch dog timer. If you or another member find time, could you look up the default power up WDT and prescaler register settings in the Data Sheet and figure out what kind of wdt 'refresh' timing we have to work with?

I suspect we can change the 'nop' instruction between the DelayLo and DelayHi loops in the DelayUS() routine to a 'clrwdt' instruction to refresh the WDT approximately every 1024 cycles.

Mike

<added>

Found it. An 18 msecs default WDT timeout means the one line change to the DelayUS() routine is a viable solution and will refresh the WDT once approximately every 1 millisecond.
Code:
DelayLo addlw   -1              ; subtract 4 cycle loop time
        skpnc                   ; borrow?  yes, skip, else
        goto    DelayLo         ; do another loop
        clrwdt                  ;                                 <--- change
DelayHi addlw   -1              ; subtract 4 cycle loop time
 
Last edited:
Mike,


(1) 16F627 version 1 Source
(2) BOR/BOD disabled
(3) WDT enabled (not important- only if its dead easy)
(4) Code protection on- Yes please

-I didnt realise it was thanksgiving today (im in scotland)- Have a good one!!

Cheers.

-Dalmation.
 
Hello,
I've done some more experimenting and made some wierd discoveries.

I mentioned that sometimes, something goes wrong and the display reverts to Zeroes.

The reason (ive found) is that the pic inputs are not drawing enough current, and the mother-board believes nothing is connected and puts the eeproms in a sleep state (annoying!!).

My old circuit (which used leds connected to the output lines) would draw 5mA from each line when in logic high state- the pic only draws 3uA!!

I am looking for a solution- if you look at the pictures of my PCB, theres not much room.

I added a 1K resistor array, pulling some of the input lines to ground. This fixed the problem, but made the display a bit wonky. The eeproms stayed on.


I was thinking (an easier solution?) -would it be possible to toggle PORTA from input (reading data) and output (pins clamped to ground).
If the alternated between these two states, we would still get a reading, and it would draw more current.


When I short the pins to ground with a wire- they each pull a max of 17mA, so the pic can handle it. I found that 2-3mA per pin is fine for keeping the eeproms awake.


Any suggestions?

Thanks

Front.JPG

Back.JPG

Working.JPG

Not Working.JPG

Temp fix.JPG
 
7 Segment Led Display

I am trying to build a display using 74ls90 BCD Counters, 74ls47 seven segment display drivers, common anode Displays by Kingbright, and 470 ohm resistors. It will require 2 of these circuits linked by pins 11 of the 74ls90 and 6 of the 74ls47 tied to the input pin 14 of the 2nd 74ls90. I found this circuit online, 7 segment LED Counter at, www.aaroncake.net/circuits/counter.asp
It seemed straight forward but I am a little rusty since it has been years since I have built anything. My need for this is to replace component boards that have been wiped out by stray voltages of 110 on a shuffle board:confused: . I have already commited about 110 dollars in parts, and am having a problem in that when tried i get numbers but in random order and sometimes a letter. If anyone can help me turn this thing around I would appreciate it.

Tom
 
Ive spent all day playing with pull down resistors- I need to add 32 resistors (about 5.6K) to the input lines- but then the display isnt sure exactly what to display. It just isnt practical on such a small board anyways- even with surface mount. I need to draw slightly more current- only a milliamp or 2 would do it

Help me out here guys-

Is it plausible to toggle PORTA between input (taking a reading) and output (pulling to ground), so it would go something like this...

PORTA output (gnd)
PortA input (measure)- display on portB outputs
Port A output (gnd)- whilst still displaying last reading on portB
portA input, taking new readings...

etc etc.

It would force the pic to draw more current on portA and should solve my problems. The delays/ program cycle time migh need tweaked a bit, but I'm sure it would work.

What do you think? Gettin desperate here.

-DAlmation
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top