-
16F877A to 18F4550 comms
i'm thinking of splitting my pulse motor conrtol system between two PIC's
4550 @ 48MHz for fast reaction to an analogue input...
877A to do all the Maths and various analogue lines for the automatic tune program.
The only things that the 4550 needs to send to the 877A would be two bytes for RPM and / or one byte for certain statuses, so 1 byte for DATA ID/status and an optional two bytes if it's RPM
The 877A will send 1byte as DATA ID/status and an optional 2 bytes if it's changing one of the tune varables...
I want to use onboard hardware comms due to lower overheads in software...
I was going to use USART @ 115K but then i realised that the USART doesn't have flow control lines...
So I looked at the MSSP in SPI mode... it doesn't have flow control ether...
I looked at PSP, but i'm not sure i'll have enough IO lines on the 877A with using an LCD too...is the RD, WR and CS flow control? Whats it speed? whats its buffering?
Whats everyones opinion on the best method?
-
I think I would use an interrupt with the USART and not worry about flow control.
EDIT:
Now I see on another post that you do not want to use interrupts... Why??
-
two reasons, i'm using PBP244 at this moment and acording to the manual their are two ways of doing interupts...
in PBP using ONINTERUPT which then causes latency in the program...
The other is in assembler and every time i read it i get a headach and don't understand it... It's alien compaired to what i'm used to...
I do plan to buy the pbp260 upgrade in 2-3 weeks... perhaps that will help
-
I can not remember if DTs Instants work with PBP244, might take a look at it.
If I understand what you are doing tou would only need the interrupt on the 4550. When the 877A needs data the routine that called for it could wait there for a response, maybe for X time. If the 4550 is not doing much maybe on-interrupt would not be to slow.
Just thoughts....
-
the 4550 basically has a loop...
read ADC1
if ADC1 is over the on trigger variable then turn on B1
If ADC1 is lower than off trigger var then turn off B1
For every time B1 is turned on increment pulse count var
If pulse count var = 4 read tmr1 and calculate RPM
Reset TMR1 and restart loop
The faster the cycle the better...
The addition would be to recieve a new ON and OFF trigger var from the 877A
The single byte 'commands' comming from the 877a are...
* Stall warning - return to predefined static settings
* Overspeed1 - stop pulsing
* Overspeed2 - engage emergency break (relay on B2)
The 877a will only be changing one var every 5 seconds or so...
The 877a will be doing all the work and the calculations and putting data on the LCD...
I don't know 'DTs instants' i'm guessing i go do a search for it... lol
-