i am trying a pi model 3 b+ with the same program than the model 3, with a mcp3008.
on the model b+, the spi is enable, works with a python program, but not with Codesys.
The wiring is the same, the parameters too (/dev/spidev0.0), it work on the model 3, but not the model 3 b+.
Someone have an idea ?
thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
i have a last problem witrh mcp3008:
i wired 2 mcp 3008 the first with chip select on pin 26, the second with chip select on pin 24.
I set 2 spi master , the first on /dev/spidev0.0, the second on /dev/spidev0.1.
It works, but when the two are wired, it seems adding the 2 values on the same input mcp3008.auiValue[0], with the mcp3008_1.auiValue[0].
Have i proceed in the wrong way ?
Thanks
Thierry
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I used two max6675 sensors to read two temps as you described that worked well. I noticed that in the driver in block 'AfterReadInputs' the transfer is immediately restarted after finishing, then I got a reading only at start of the program.
I solved this by adding a delay of a few cycles before restarting the transmission again which did the trick.
This allows you to read max two sensors.
Also noticed that you can manipulate the chip enable by disconnecting the wire, so in theory you can use gpio's to control the demultiplexing of multiple sensors.
See a copy of the driver routine;
SUPER^.AfterReadInputs();
IF_iState=10THENaby[0] :=0;aby[1] :=0;IFtransfer(pabyTxBuffer:=ADR(aby) , pabyRxBuffer:=ADR(aby) , udiLen:=2 , uiDelayus:=5)THEN_iState :=20; // jump out of step to stop transmissionEND_IFui :=aby[1];ui :=ui+(BYTE_TO_UINT(aby[0]))*256;auiValue :=ui/4;END_IF;//delayrestartoftrasnmissionIF_iState>10THEN_iState :=_iState-1;END_IF;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i am trying a pi model 3 b+ with the same program than the model 3, with a mcp3008.
on the model b+, the spi is enable, works with a python program, but not with Codesys.
The wiring is the same, the parameters too (/dev/spidev0.0), it work on the model 3, but not the model 3 b+.
Someone have an idea ?
thanks
Hi,
guess this might solve your Problem(reduce SPI speed):
l viewtopic.php?f=21&t=8658 l
BR
Edwin
HI
Many thanks Edwin, it works for me, great!
Thierry
Hi
i have a last problem witrh mcp3008:
i wired 2 mcp 3008 the first with chip select on pin 26, the second with chip select on pin 24.
I set 2 spi master , the first on /dev/spidev0.0, the second on /dev/spidev0.1.
It works, but when the two are wired, it seems adding the 2 values on the same input mcp3008.auiValue[0], with the mcp3008_1.auiValue[0].
Have i proceed in the wrong way ?
Thanks
Thierry
Hi,
I used two max6675 sensors to read two temps as you described that worked well. I noticed that in the driver in block 'AfterReadInputs' the transfer is immediately restarted after finishing, then I got a reading only at start of the program.
I solved this by adding a delay of a few cycles before restarting the transmission again which did the trick.
This allows you to read max two sensors.
Also noticed that you can manipulate the chip enable by disconnecting the wire, so in theory you can use gpio's to control the demultiplexing of multiple sensors.
See a copy of the driver routine;
SUPER^.AfterReadInputs();