Close

First software - by al1

A project log for PICTIL

Remake of the TIL311 hex LED display with recent technology.

alexAlex 11/28/2015 at 21:575 Comments

While waiting on the PCBs I started to program the software. This was also the first time I did use PIC controllers so I was a little bit slowly. And at first PICs were a little bit confusing. Not all features do work yet but the basic functionality (decoding four inputs into led signals) is working. Here is some photo of my setup:

I will upload the software at bitbucket. So if anybody finds some mistakes or do have suggestions please write them! But note this software is not ready yet.

Discussions

Yann Guidon / YGDES wrote 11/29/2015 at 03:21 point

I am trying to change the system so it stores data in the Flash memory, which would be more convenient, for both C and asm version. My hack with the data memory banks requires access to the constants anyway so it's better to read them there :-)

  Are you sure? yes | no

Yann Guidon / YGDES wrote 11/29/2015 at 04:11 point

Some preliminary code is at  http://ygdes.com/~whygee/PICTIL.asm

It uses the 64-bytes data Flash to store the constants. I have directly mapped the inputs to the Flash addresses so the code has almost no computing to do. However the constant table must be... modified and interleaved. I hope my tired brain did not do too much damage to the original constants :-)

I have no 16F527 to play with so I let @al1 examine the code, correct it, add the proper headers, etc.

However I have tens of 16F628 in TSSOP18 for a planned similar design with 7 segments :-) Studying this code gave me some inspiration.

  Are you sure? yes | no

Yann Guidon / YGDES wrote 11/28/2015 at 22:25 point

Yay !

Don't hesitate to submit the source code to me, as I have some experience with PIC assembly (which, like the x86, I wish I didn't need... but it's another story).

I believe that the PIC can run in a tight loop of a dozen of instructions (at most).

After init (another dozen of opcodes), read the input nibble, shuffle the bits to fit into a (0-15)*4 value, add to PCL, write immediate value (first half) to port, retlw the second half, write this value to the other port, and loop... the update should be very fast, depending on your clock settings.

  Are you sure? yes | no

Alex wrote 11/29/2015 at 00:09 point

The code is now on bitbucket (https://bitbucket.org/_al1/pictil). I did use C for programminng and the free version of the XC8 compiler so far. As clock source i used the internal 8MHz oscillator. 

  Are you sure? yes | no

Yann Guidon / YGDES wrote 11/29/2015 at 00:21 point

8MHz means 2MIPS, that's fast enough :-)
The C code looks cool but I would have done it differently. There are many things that I could optimise out :-D
Just an example:
newNumber=(PORTAbits.RA4<<3)+(PORTAbits.RA5<<2)+(PORTAbits.RA0<<1)+PORTAbits.RA1;
Take PORTA, mask the relevant bits, then reorganise the constant array :-) bit 0 and bit 1 are swapped so the corresponding entries are modified.
I'll have to code that...

  Are you sure? yes | no