No of starts a PIC can run

dbarry722

Member
Hi Folks..

How or where in the datasheet can you determine the number of program starts a PIC can run.

Using PIC Logicator, the 08M and 14M seem to only accept 1 start whereas the 14M2 accepts 4 starts.

I've used PIC logicator to simulate 4 starts just to get the out put on 4 pins to go from logic state 0 to 1 with different wait times.

Some may ask why so many starts. The reason is, each lighthouse has a different flashing characteristic so I'm looking to relicate pictorially each lighthouse my father served on within a framed photograph of the map of Ireland using miniature led's or surface mounted led's.

What would be nice is to 'map' the whole island of ireland's lighthouses with just a colour alteration to denote the lighthouses my father served on.

What chip or combination of chips would cover approx 60 starts or is there a simplar way of mimmicking 60 odd individual flashing sequences at the same time :confused:

Helpe greatly appreciated

Declan
 

BillyGreen1973

Senior Member
You don't need different progrms for each LED.
A picaxe like the 14M can directly control 6 LED's (1 on each output pin), all this done in one program.

To do 60 you could use two 40x2 picaxe as each has 32 I/O pins.
As its only the flash rate your looking for on each LED, the commands to control each LED don't have to be exactly at the same time.

You might find the section on 'Let outpins=' in the manual useful.
 
Last edited:

westaust55

Moderator
On a more useful note, if using the 18M2 (or several of them) so code of this nature would allow you to perform events at increments of 1 second when running at default speed.

Code:
#Picaxe 18M2
Do
b10 = time     ; capture time as the real time will continue to
                   ; increment while other tasks are being performed
b11 = b10 // 3
  If b11 = 0 Then
    PulsOut B.0, 1000 ; pulse pin B.0 every 3 seconds
  End If
b11 = b10 // 8
  If b11 = 0 Then
    PulsOut B.1, 1000 ; pulse pin B.1 every 8 seconds
  End If
Loop

You might need to provide more information abut the timing sequences if you seek more detailed/complex answers.
 

hippy

Ex-Staff (retired)
Using PIC Logicator, the 08M and 14M seem to only accept 1 start whereas the 14M2 accepts 4 starts.
That is correct; only the M2 parts have the multi-tasking capabilities and allow multiple starts.

Further details in PICAXE Manual 1, "Parallel Task Processing".
 

dbarry722

Member
I think the thread Eclectic mentioned above (http://www.picaxeforum.co.uk/showthr...ht=lighthouses)
answered all the questions regarding flash patterns etc, and gave working code to be going on with.
Ohh deeaar! :(

Sorry folks. Just having one of those days. Yes, it is a restart of a previous thread. Damn it. Now I know what that search box is for :eek:

I'll trawls back through the thread and get back if (when) additional help required.

Declan
 

dbarry722

Member
Hi Folks..

Just tried out Tom2000's code but an error crops up at line 79

if Position > Size then (seems to indicate a problem with the '&gt' bit)

Can anyone help me out on this so that I can simulate what is happening with his code.

Declan
 

Attachments

inglewoodpete

Senior Member
Hi Folks..

Just tried out Tom2000's code but an error crops up at line 79

if Position > Size then (seems to indicate a problem with the '&gt' bit)

Can anyone help me out on this so that I can simulate what is happening with his code.

Declan
> is html for ">" but without the quotes.

On "how do I run lots of lighthouses off a PICAXE", I would use a 20X2 or 18M2 and some form of output expander like several 74HC595s or an i2c equivalent. Store the sequences in EEPROM and output them when required. Eg change the outputs every 0.5 seconds (or whatever the smallest period is)
 

dbarry722

Member
Ahh!! Got it all now.

I've changed the relevant bits and ran the code but I can't quite work out what is happening on the simulator . All it seems to be doing is switching the outputs high on pins 0 - 7 one after the other then switching them off.

Declan
 

westaust55

Moderator
Ahh!! Got it all now.

I've changed the relevant bits and ran the code but I can't quite work out what is happening on the simulator . All it seems to be doing is switching the outputs high on pins 0 - 7 one after the other then switching them off.

Declan
That is pretty much what Tom2000 stated he made the code do in the absence of your lighthouse timing data in the 2007 thread:
Declan, here's an 18X working version. I didn't have any lighthouse patterns handy, so I built the program to flash the Morse digits 0 through 7 on outputs 0 through 7.
 
Last edited:

dbarry722

Member
Yknon.. I need slapped :D

I just read it wrong. I thought he meant that he was tapping out the numbers on an individual pin which was why I couldn't initially see say '1' (.----)being 'flashed' out on a pin 1, 2 (..---) on pin 2 etc

Understand now.

Declan
 

dbarry722

Member
Hi Folks.

Following on from lighthouse patterns, I've managed to look at the lighthouses my father was on and group them into odds and evens so that from timings, I could possibly see a patterns (mapped it out in excel)

As it stands, I've been able to map 4 of the lighthouses in such a way that the 'pattern' of all 4 repeat every 45 seconds.

What would the best way be to run a 45 second loop in such a way that for every second, switch on particular pins.

I've attached a PDF showing the patterns and when the repeat starts

Regards

Declan
 

Attachments

Last edited:

eclectic

Moderator
Start with something like this

Code:
main:

	pins = %1000
pause 1000
	pins = %0100
pause 1000
	pins = %1010
pause 1000
	pins = %0001
	
	and so on
e
 
Last edited:

dbarry722

Member
Hi Folks..

Just a query on a 14M2 chip.

I did an initial flowchart out on PIC Logicator for the 4 lighthouse starts and copied it over to Basic and simulated it through Programming Editor.

It ran as expected in the simulator and I noticed 2 outputs not used so being the inquisitive type I copied 2 additional lighthouse sequences and added them to outputs 0 and 5 and ran the simulation.

It ran!!

How come - if the chip can only accept 4 starts?

Is this a quirk of the simulator or would this work if downloaded to a 14M2 chip?

Declan
 

Attachments

Last edited:

dbarry722

Member
Cheers Hippy.

Many thanks for that. Not even going to get into the debate on the release date of the 14M2 or 20M2? :D

Declan
 
Last edited:

westaust55

Moderator
How come - if the chip can only accept 4 starts?

Is this a quirk of the simulator or would this work if downloaded to a 14M2 chip?

Declan
the program example from eclectic is only using one start.

If you breaks all of you light house sequences down into a basic time increment you just keep feeding data to the pins "variable".
You could even store the sequence in EEPROM on a larger PICACE and just read the data and push it out on the pins one byte at a time.
 

dbarry722

Member
Hi westaust55

That was something I was going to enquire about. I've been looking at Toms code where he has been outputting the morse code but can't quite work out how the data inside the represents the relevant numbers 0 - 7

Regards

Declan


data 0,(23,%00000111,%01110111,%01110111) ; 0
data 4,(21,%00000001,%11011101,%11011101) ; 1
data 8,(19,%00000000,%01110111,%01110101) ; 2
data 12,(17,%00000000,%00011101,%11010101) ; 3
data 16,(15,%00000000,%00000111,%01010101) ; 4
data 20,(13,%00000000,%00000001,%01010101) ; 5
data 24,(15,%00000000,%00000101,%01010111) ; 6
data 28,(17,%00000000,%00010101,%01110111) ; 7
 

eclectic

Moderator
@Declan.

1. How many lighthouses will your display require?

2. Depending on the answer, what Picaxe chip are you planning?

e
 

westaust55

Moderator
Declan,
I believe that I may be having the same thoughts on your project as eclectic.
You have previously mentioned 60 light houses.

IMHO you need to establish the intended hardware. Options are several Picaxe chips or maybe one 18M2 and say four MCP23017 i2c based IO expander chip giving in excess of the needed 60 outputs.

We need to get the hardware concepts clear before the code can be firmed up.
 

dbarry722

Member
Hi Folks..

Originally I was thinking of plotting the whole of Ireland which is approx 60-70 but I gotta learn to crawl before I can walk so am looking at anywhere between 8 and 20 plus, the map would be too cluttered even if I used SM LED's.

Given that the 14M2 and 20M2 chips will support 8 parallel starts, I could work with them but if one chip can support a system where more than 8 flashing sequences can be incorporated into a data chain similar to the morse code, that would be great.

I've been able to merge together code (supplied here on the the forum) on an 08M chip that gives the appearance of a rotating flash using the PWMOUT command. I don't have a 18M2 chip or board to replicate 4 in practice but things are looking promising based on assistance from folk on the forum.

I was looking across Dundrum Bay last night at St Johns Point Lighthouse and I can see where the PWMOUT really comes into play and will make the flashing system more 'real' like.

Declan
 

hippy

Ex-Staff (retired)
Don't get too hung up on the M2's and their multi-tasking abilities.

Although that allows up to 8 individual sequences to be controlled easily per M2 chip, you can handle up to however many outputs any PICAXE has with just a single start, and you can control more outputs than a PICAXE chip has with shift registers or LED multiplex drivers - Assuming the PICAXE has enough data/program memory to store the sequences.

Anywhere between one PICAXE per lighthouse and one PICAXE for everything is possible.

There's nothing wrong with a single chip controlling 8 lighthouses and it's an easy way to do the project and that makes an M2 a good choice; once one program controls 8 lighthouses, you just have to add another M2, tweak the code and you've got another set of 8 done and dusted.

I'm not sure how the PWMOUT is intended to be used but that could affect how to divvy-up lighthouse control between PICAXE's.

For me, a really nice system would be one PICAXE per lighthouse, each running identical code with inputs set to give each a unique ID, and a PC or other PICAXE which programs the sequences for each. Elegant doesn't however equate to cheapest, and each PICAXE controlling multiple lighthouses makes sense. It's always hard however trying to decide how many a single PICAXE should control, and that can depend on exactly what hardware and abilities are required for each LED. You're on the right path in experimenting and 'prototyping' with possibilities.
 

dbarry722

Member
Cheers Hippy..

From a distance if you look at a lighthouse when it is operating it gives the appearing of a flash but in actual fact most are (not all) a rotating set of optics that focuses the light from the bulb into a narrow beam. This is more apparent the closer you get to the lighthouse.

As it stands I can simulate a lighthouse on one 08M with the PWMOUT to give an appearance of flashing to make it 'look' more realistic.

As a protype, I'm going to knobble one of my Garden solar lights and rewire it to an 08M chip to see how well it operates. The only thing that may scupper the plans is whether the 08M will operate at 2.4volts.

Off to look at the spec of the 08M chip

As we say over here, 'God loves a trier':D

Declan
 

westaust55

Moderator
From the datasheet for the PIC used for the 08M (see manual 1 V 7.5 on page 16) http://ww1.microchip.com/downloads/en/devicedoc/41211d_.pdf

The lowest voltage for operation of the 08M is 2 Volts for clock speeds up to 8MHz and 3Volts at 10MHz

I have frequently operated and programmed 08M's and 18X's at 3 Volts.

Recall others have had difficulties programming at lower voltage levels - so be aware it may run at 2V but you may need say 3V to program.
 

westaust55

Moderator
Hi westaust55

That was something I was going to enquire about. I've been looking at Toms code where he has been outputting the morse code but can't quite work out how the data inside the represents the relevant numbers 0 - 7

Regards

Declan


data 0,(23,%00000111,%01110111,%01110111) ; 0
data 4,(21,%00000001,%11011101,%11011101) ; 1
data 8,(19,%00000000,%01110111,%01110101) ; 2
data 12,(17,%00000000,%00011101,%11010101) ; 3
data 16,(15,%00000000,%00000111,%01010101) ; 4
data 20,(13,%00000000,%00000001,%01010101) ; 5
data 24,(15,%00000000,%00000101,%01010111) ; 6
data 28,(17,%00000000,%00010101,%01110111) ; 7
Sorry did not respond earlier to your question.

Tom's method is a bit like the old mechanical drum type organs with a rotating drum with pins/holes.
You feed one bit at a time from each data set to the corresponding PICAXE output pin.

Tom is reading data from right to left with the right most 3 bytes for each morse code number the first (left most) byte indicates hown many bits to use - always ending with 4 zeros as a morse "character" space.
1 for a high, 0 for a low
so reading from right to left
data 8,(19,%00000000,%01110111,%01110101) ; 2
treat a 0 as a spacer sp
10101110 11101110 000----
dot dot dash dash dash :)

and
data 20,(13,%00000000,%00000001,%01010101) ; 5
10101010 10000--- --------
dot dot dot dot dot :)

also
data 28,(17,%00000000,%00010101,%01110111) ; 7
11101110 10101000 0-------
dash dash dot dot dot
 
Top