News:

;) This forum is the property of Proton software developers

Main Menu

Simple fast coms on pin limited device

Started by TimB, Jul 21, 2021, 08:12 AM

Previous topic - Next topic

TimB


Hi,

I need to monitor 32 adc inputs. First thought was an Analogue multiplexer. 2 x 16input device

Then I though why not just a 44 pin pic and use the ADC inputs

Issue is that I need 2 way coms. I have code to turn a pic into an SPI slave that takes 4 pins
CS
SDO
SDI
SCL

The issue is that on a 44/40 pin device with 35 ADC it's eating into the ADC pins as the SPI lines all sit on ADC inputs.

I go from 35 to 31 and while I may be able to get away with 31 inputs I would rather 32

Any tips on how to get that xtra ADC line back or different multi-drop coms. BTW It needs to be reasonably fast, so the master is not left hanging around for ages waiting for a reply.

Rather not use RS232 on the Master as I need it to coms with the outside world

Saying that if the Master had 2 Usarts I might work

Send a broadcast to the 2 slaves. Message to board 1. Send the data....

Hmm might be the best option, but how to protect the TX and RX lines form holding each other. Need to do some reading

Tim






TimB


Rs232 multi drop needs tri state drivers

Perhaps I need to swap to say i2c

Anyone done any work with enabling i2c slave on a pic?

Tim

trastikata

#2
Tim, is it a problem going for 64-pin devices?

Or if you need few extra ADC channels - can yo use external 4-6 channel ADC with SPI interface? This will cover for the lost pins as SPI lines.

TimB


The issue is that I have to work with devices that do not cost ££££ eg the £8.00 64 pin devices and the no-stock everything else.

I'm looking at using a Pic16F18877 as Farnell actually have stock of that part

I think Slave 12c is the way to go. Need to find out how to implement that in interrupts

Tim

trastikata

#4
Quote from: TimB on Jul 21, 2021, 08:42 AMThe issue is that I have to work with devices that do not cost ££££ eg the £8.00 64 pin devices and the no-stock everything else.

How many do you need Tim?

Mouser UK has 11  PIC18F65K40-E/MR still in stock, I see other QFN-64 PICs with +32ADC inputs (i.e. PIC18F67K40-I/MR) are in stock, all cost around 1.8 GBP

TimB


11? Gone now and the other device you listed


I cannot design products based around parts that have virtually no stock.


trastikata

Quote from: TimB on Jul 21, 2021, 09:52 AM11? Gone now and the other device you listed
I cannot design products based around parts that have virtually no stock.

I understand that, but that link below shows 134 QFN's in stock?

https://www.mouser.co.uk/ProductDetail/Microchip-Technology/PIC18F67K40-I-MR?qs=%2Fha2pyFaduiLEn9C810rures2%252BcvqQVKU%252Btfa0Q06ZLtNH0t6AdDKw%3D%3D

If you need more than 160 pcs, I'd use Microchip Direct, they have 800 QFP's PIC18LF67K40-E/PT in stock.

John Drew

Tim,
If you need an example of interrupt driven i2c slave I can send it tomorrow. It includes a buffer as used in my latest project.
John

TimB


Hi John

Brilliant!!!

Thanks, really appreciated!

Tim

John Drew

#9
Will do Tim.
It's 9pm and it's freezing down here, 6C outside. I'll wait till the sun is up again as my ham shack is in the shed.
John

TimB



6C!

Thats cold for Auz. My Brothers lives in Melbourne a balmy 10c now

I LOVE tree ferns Australian dicksonia antarctica and now I know why they are so hardy. 

John Lawton

Quote from: TimB on Jul 21, 2021, 09:52 AM11? Gone now and the other device you listed


I cannot design products based around parts that have virtually no stock.


Tim. I sympathise. I use this site to determine availability of devices, not just PICs, but other components: https://www.findchips.com/

Stephen Moss

Tim,
maybe a couple of these 16 channel IC2 ADCs would be the solution, you may be able to offset some of the cost of external ADC's buy using a smaller PIC as being I2C you can access 32 ADC channels with just two pins on the PIC.

Another possible option depending on what you need in terms of speed/resolution is to use your currently intended 44 Pin PIC but sacrifice a couple more ADC pins for I2C to access a 4 channel I2C ADC. I cannot currently access the device number I have used before but it would be similar to (if not) a PCF8591.
It may not have the same spec as the internal ADC of your currently selected PIC but if there are 4 signals that do not need the accuracy of PIC's internal ADC's this in conjunction with the remaining 29 PIC ADC inputs might be sufficient for you to monitor all 32 inputs. 

trastikata

#13
Quote from: TimB on Jul 21, 2021, 08:12 AMIssue is that I need 2 way coms. I have code to turn a pic into an SPI slave that takes 4 pins

Tim, PIC18F56K42 has 43 PPS remappable ADC channels within 44 I/O pins. Mouser carries 100's of them in stock at 1.7 GBP per piece.

When looking for suitable MCU, I always use Microchip MAPS - makes searching using defined requirements much easier.

TimB


The i2c slave by JohnD solves the issues.

As PCB space is very limited I think I need to stick to as small a device as I can now.


John Drew

Did you get the email OK Tim?
John

TimB


John Drew

Hi Tim,
I sent it about 12 hours ago.
I wonder if i have the correct email address.
Would you send me a PM with it and i will resend with another one of my email addresses.
John