Recent

Author Topic: Problem with bit bang spi in raspberry pi with lazarus.  (Read 4398 times)

sabouras

  • New Member
  • *
  • Posts: 18
Problem with bit bang spi in raspberry pi with lazarus.
« on: December 06, 2016, 08:09:46 pm »
Dear All,

I am new in pascal and i am using the lazarus with the raspberry pi. I am trying to read the MCP3202 which is an SPI 12bit ADC.
As i have see in forums there is not some SPI wrapper for lazarus with some examples so i could use it. I try to make my own code with the bit bang SPI technique.
I am attaching my code in order to somebody help me and guide me where i am doing wrong and i do not have any result.

I try some python examples i found online and i see some results. The MCP3202 is connected in SPI 0 channel with CS_0.
I connected with the trimmer at the input and i measure 1 volt and  i use it from the 3.3 volt which provide the raspberry pi.
Thanks in advance for your time and your efforts.
Best regards to all.

TommyFree

  • Newbie
  • Posts: 5
Re: Problem with bit bang spi in raspberry pi with lazarus.
« Reply #1 on: December 18, 2016, 07:18:19 pm »
Hi,
when using Raspberry pi under Linux you can use the pigpio-library  http://abyz.co.uk/rpi/pigpio/.
Look there at    Examples/C code/SPI bit bang MCP3202.

Much success!
« Last Edit: December 18, 2016, 07:19:52 pm by TommyFree »

sabouras

  • New Member
  • *
  • Posts: 18
Re: Problem with bit bang spi in raspberry pi with lazarus.
« Reply #2 on: December 19, 2016, 05:58:27 pm »
Dear Tommy,

Thank you very much for your advice. Unfortunately at least to my testing board this piece of code does not working. I change the pin mapping according to my RPI but i still does not get any results except 0.

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: Problem with bit bang spi in raspberry pi with lazarus.
« Reply #3 on: December 19, 2016, 06:36:28 pm »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

 

TinyPortal © 2005-2018