Desire
Hello everyone!
Has anyone tried the Pico ADC?
I find that it works in 10-bit resolution. At 3.27V, the number content is 1022 and it ends there.
According to the manual, it should work with 12-bit resolution and 16-bit number content.
Thanks if anyone has any ideas.
yonush
Hi, The HAL for the Pico can be amended to 12 bit. You can change this by editing the rp2040pico.cpp file (in the editor\editor\arduino\src\hal folder) . Make the changes as per the following code in the hardwareinit function.
 
 
void hardwareInit()
{
     // set the analog input resolution to 12bit
    analogReadResolution(12);
    // set the analog output resolution to 16bit
    analogWriteResolution(16);
...
}
Reply 0 0
Desire
Dear yonush,
Thanks for the help, it works!
Can you help me with how to correctly program the DS18D20 sensor in openPLC for Pico?
If I choose library\Arduino\DS18D20 FB, the task management of the program is broken. I get a faulty run. What can be the solution?
Thanks in advance.
Reply 0 0
thiagoralves
The DS18B20 sensors are very slow and can cause problems on some boards. Maybe your best bet would be to try reading them from the Arduino Extension
Reply 0 0
yonush
Yes, they are rather slow. I had the same issue with using DHT11/22. I had to write my own Aduino code and FB for the DHT. Basically i get a reading only when the DHT is ready.  It is also the same issue I had trying to use the SSD1306 OLED display which is also slow to upd. My next plan was to create another arduino routine that ran on the 2nd core of the Pico to deal with the slower devices without impeding the main PLC loop.
Reply 0 0
Desire
Thanks for your help, I'll stick with the analog sensor.
Reply 0 0
Reply