Binary Clock from Highschool, Lost code PIC18f2525

Thread Starter

stobby

Joined Jun 20, 2018
26
Hi everyone, First time poster here so bare with me. Here's the story Many years ago when i was in my senior year at high school I did a work experience program at a small electronics engineering and manufacturing company. My Task With the boss was to create a 24hr Binary clock Utilizing a PIC micro-controller (18F2525) (28Pin). Now at the time i was confident with construction of simple electronics and SMD boards, However i had and still haven't got any experience with C-programing of these chips. Anyway he showed me some basics of mplab and the standalone Pickit program and did the rest for me.

Now this is about 7 years down the track and i thought i would play with it again only to find the chip is blank.
obviously every circuit configuration is programmed to different I/O's and configs. so i need help with creating the C-code for this circuit. i am using MPLAB X IDE and i have both PICKIT 2 and 3.

The pictures show the project with the red arrow highlighting the MCLR pin. And the Black box highlights the external crystal circuit.
From the Side on photo you can see the LED's are in a Grid formation.
Don't hesitate to ask for more photos or more info, I sincerely appreciate any help, Kind regards Brent.

IMG_1873.jpg
binary clock back.jpg
binary clock side.jpg
 

AlbertHall

Joined Jun 4, 2014
8,513
The first task is to determine how the LEDs and buttons are connected to the chip: which pins they connect to; buttons active high or low; LED polarity.
 

Thread Starter

stobby

Joined Jun 20, 2018
26
will update with a circuit diagram shortly. In the meantime, there a two things that i cant understand in the circuit.
The crystal oscillator is connected to pins 11 and 12. which don't seem related to an external clock?
secondly both switches are connected to the same source and output to the same location, however i remember them both having different functions.

Will upload circuit diagram Later tonight. Regards Brent
 

WBahn

Joined Mar 31, 2012
24,853
It's extremely hard to trace very much of the wiring based on the pictures -- and that really is something YOU need to do. So do get that diagram posted.

But it doesn't look to me like the switches are connected to the same pins.

Pins 11 and 12 appear to be for an secondary oscillator. Is it possibly you are using the internal oscillator to run your code and the crystal oscillator as your timebase? I don't know why you would have done that, but that might explain the connections.
 

AlbertHall

Joined Jun 4, 2014
8,513
The secondary oscillator can be used as the CPU clock and might well be for this device as there is at least one second between operations.
upload_2018-6-21_11-21-43.png
 

MaxHeadRoom

Joined Jul 18, 2013
19,169
Hi everyone, First time poster here so bare with me.
We can help, but probably no need to Strip Down!o_O
But 'Bearing' with you it does certainly appear to have a 32Khz Xtal on pins 11 & 12 for a 1 sec TMR1 clock , don't see the customary 22pf caps though.?
Max.
 

AnalogKid

Joined Aug 1, 2013
8,140
Schematic first. With that, you can define the function of each pin. With that, you can define the I/O port configuration registers, and start assigning names to the various I/O pins. Then you are ready to tackle the body of the code.

ak
 

Thread Starter

stobby

Joined Jun 20, 2018
26
Hey guys, Some really helpful information above, Once again greatly appreciated. Yea i was assuming the xtal (32khz) had something to do with TMR1. And yes every cap and resistor is SMD other then C-4 illustrated in my schematic which is a 25v 10uf.

There are some bits that might not be correct on the schematic, *1 I don't know what type the transistors are attached to LED's they have no writing on them.
*2 I don't know whether the push buttons are normally open or closed.
For reference the 6 PICKIT pins are at the top of the picture
Thanks again everyone.
Binary-clock.jpg
 

AnalogKid

Joined Aug 1, 2013
8,140
Recheck the R2, R3, and switch wiring on the board. One end of both switches probably goes directly to either Vdd or Vss. Same for R2 and R3. A shown now, your switches put a dead short on the power supply.

ak
 

AlbertHall

Joined Jun 4, 2014
8,513
I strongly suspect that all the LEDs should 'point' upwards on your diagram.
I strongly suspect that the connections shown for the transistors are wrong.
The usual pinout for those transistors is as shown below. Please check.
 
Top