![]() |
Forum Index : Microcontroller and PC projects : PicoMite V6.00.00 release candidates - all versions
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6289 |
What was wrong with leaving r as a long long int ? if( ( ( ((r >> 8) & 0xff) + ((r >> 16) & 0xff) + ((r >> 24) & 0xff) + ((r >> 32) & 0xff) ) & 0xff) != (r & 0xff)) goto error_exit; // returning temperature VK7JH MMedit |
||||
zeitfest Guru ![]() Joined: 31/07/2019 Location: AustraliaPosts: 589 |
Just something to watch out for - in some systems, bit shifting right does not necessarily set the most significant bit to 0. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6289 |
Yes, that makes sense. I changed my test to include the checksum before masking with &hFF Whenever the checksum is over 255, MMBasic returns 1000 0000001001110101000000001011100000101111 303 18.4 62.9 1000 1000 0000001001000010000000001011011111111011 251 18.3 57.8 18.3 57.8 0000001000111001000000001011011111110010 242 18.3 56.9 18.3 56.9 0000001000110001000000001011011111101010 234 18.3 56.1 18.3 56.1 0000001000101100000000001011011111100101 229 18.3 55.6 18.3 55.6 0000001000100101000000001011011111011110 222 18.3 54.9 18.3 54.9 0000001110110101000000001011100101110001 369 18.5 94.9 1000 1000 0000001011011011000000001011100010010101 405 18.4 73.1 1000 1000 0000001011001101000000001011100010000111 391 18.4 71.7 1000 1000 0000001010100110000000001011100001100000 352 18.4 67.8 1000 1000 Jim VK7JH MMedit |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10367 |
Jim Can you print out the received data as bytes when it passes and when it fails then I can check what is happening and fix - thanks |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6289 |
Having trouble getting many passes tonight. 5 bytes in order followed by calculated values then MMBasic output. 1 172 0 193 110 fail 19.3 42.8 1000 1000 1 170 0 192 107 fail 19.2 42.6 1000 1000 1 167 0 193 105 fail 19.3 42.3 1000 1000 1 181 0 192 118 fail 19.2 43.7 1000 1000 2 94 0 193 33 fail 19.3 60.6 1000 1000 1 238 0 193 176 fail 19.3 49.4 1000 1000 1 200 0 193 138 fail 19.3 45.6 1000 1000 1 187 0 193 125 fail 19.3 44.3 1000 1000 1 183 0 193 121 fail 19.3 43.9 1000 1000 1 176 0 193 114 fail 19.3 43.2 1000 1000 1 174 0 192 111 fail 19.2 43 1000 1000 2 122 0 194 62 fail 19.4 63.4 1000 1000 2 11 0 193 206 Pass 19.3 52.3 19.3 52.3 1 209 0 194 148 fail 19.4 46.5 1000 1000 1 187 0 193 125 fail 19.3 44.3 1000 1000 1 177 0 193 115 fail 19.3 43.3 1000 1000 2 216 0 194 156 fail 19.4 72.8 1000 1000 2 41 0 194 237 Pass 19.4 55.3 19.4 55.3 1 219 0 194 158 fail 19.4 47.5 1000 1000 1 194 0 194 133 fail 19.4 45 1000 1000 1 187 0 193 125 fail 19.3 44.3 1000 1000 1 184 0 194 123 fail 19.4 44 1000 1000 3 82 0 195 24 fail 19.5 85 1000 1000 2 18 0 195 215 Pass 19.5 53 19.5 53 1 211 0 194 150 fail 19.4 46.7 1000 1000 Assuming you do need the uint8_t stuff, I added an extra pair of brackets to your code but not in a position to try it. if( ( (uint8_t)(( ((r >> 8) & 0xff) + ((r >> 16) & 0xff) + ((r >> 24) & 0xff) + ((r >> 32) & 0xff) ) & 0xff) ) != (uint8_t)(r & 0xff)) goto error_exit; Jim VK7JH MMedit |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2604 |
math scale samples!(),239,samples!()'scale to 240 pixel height changed to math scale samples!(),139,samples!()'scale to 140 pixel height and it's the same, 239 PicoMiteVGA MMBasic USB Edition 6.00.00RC15 OPTION SERIAL CONSOLE COM2,GP8,GP9 OPTION AUTORUN ON OPTION FLASH SIZE 4194304 OPTION COLOURCODE ON OPTION KEYBOARD UK, 0, 0, 600, 150 OPTION CPUSPEED (KHz) 378000 OPTION DISPLAY 30, 53 OPTION SDCARD GP13, GP10, GP11, GP12 OPTION AUDIO GP0,GP1', ON PWM |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2669 |
Jim and Peter To help find the condition that causes the Humid error here is a DHT emulator that lets you set the values of the data bytes independently. The variable q can be used to increment the bytes on each response. ' "DHT Test Emulator 01.bas" ' SetPin GP1, DIn, pullup 'Diode A to GP1, K to GP0 3.3k to 3.3V and link to other Pico for Humid. Dim integer a(83), b1, b2, b3, b4, b5, word, n, m, q=60 Do Math Set 50, a() : a(0)=80 : a(1)=80 b1=q : b2=q : b3=q : b4=63 b5 = (b1+b2+b3+b4) And 255 'make checksum word = (b1<<32) + (b2<<24) + (b3<<16) + (b4<<8) + b5 m=0 : Print Bin$(word,40) For n=81 To 2 Step -2 a(n) = 26 + 44 * ((word >> m) And 1) ' Print n,m,a(n) Inc m Next Print "Waiting to receive HUMID command (either type 0 or 1)" Do While Pin(GP1) : Loop Pin(GP0) = 1 SetPin GP0, DOut 'Diode K to gp0, A to GP1, Do : Loop Until Pin(GP1) Device BitStream GP0, 83, a() Pin(gp0)=1 SetPin gp0, off Inc q Print "Sent "; b1, b2, b3, b4, b5 Loop End Saved 1035 bytes and the response of Humid0011110000111100001111000011111111110011 Waiting to receive HUMID command (either type 0 or 1) Sent 60 60 60 63 243 0011110100111101001111010011111111110110 Waiting to receive HUMID command (either type 0 or 1) Sent 61 61 61 63 246 0011111000111110001111100011111111111001 Waiting to receive HUMID command (either type 0 or 1) Sent 62 62 62 63 249 0011111100111111001111110011111111111100 Waiting to receive HUMID command (either type 0 or 1) Sent 63 63 63 63 252 0100000001000000010000000011111111111111 Waiting to receive HUMID command (either type 0 or 1) Sent 64 64 64 63 255 0100000101000001010000010011111100000010 Waiting to receive HUMID command (either type 0 or 1) Sent 65 65 65 63 2 0100001001000010010000100011111100000101 Waiting to receive HUMID command (either type 0 or 1) Sent 66 66 66 63 5 0100001101000011010000110011111100001000 Waiting to receive HUMID command (either type 0 or 1) Sent 67 67 67 63 8 0100010001000100010001000011111100001011 Waiting to receive HUMID command (either type 0 or 1) Sent 68 68 68 63 11 0100010101000101010001010011111100001110 Waiting to receive HUMID command (either type 0 or 1) Sent 69 69 69 63 14 0100011001000110010001100011111100010001 Waiting to receive HUMID command (either type 0 or 1) > > do :humid gp1,t,h,0 :? t,h :pause 1000 : loop 1542.3 1542 1567.9 1567.7 1619.1 1619.1 1644.7 1644.8 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 > Edited 2024-11-20 12:16 by phil99 Footnote added 2024-11-20 13:43 by phil99 Any combination of bytes that causes the checksum to rollover to zero produces "1000 1000" so Gerry's diagnosis is correct. Footnote added 2024-11-20 16:47 by phil99 A one pin version that doesn't need the diode or pullup resistor. DHT Test Emulator 04.zip Footnote added 2024-11-22 09:47 by phil99 RC16 has cured this issue. I note that the "wake" pulse delivered by Humid to the DHT is slightly longer for both types by about 0.5mS. This may reduce the frequency of occasional random errors that many people observe. The DHT Test Emulator 04.bas in the previous footnote needs to be modified to accommodate this. Use the values of z in the line below. Dim float t, z= 1.5 '"wake" pulse duration - 1.5 = DHT22, 19.5 = DHT11 Footnote added 2024-11-22 16:31 by phil99 An auto adjusting version. Measures the first Wake pulse and adapts to Old / New humid and DHT11/22. DHT Test Emulator 06.zip |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2669 |
Stan, perhaps Math Window is what you need. Math Scale just multiplies the values by a constant. eg > clear > dim samples(24) : for n=0 to 24 : samples(n)=n : next : math v_print samples() 0.0000, 1.0000, 2.0000, 3.0000, 4.0000, 5.0000, 6.0000, 7.0000, 8.0000, 9.0000, 10.0000, 11.0000, 12.0000, 13.0000, 14.0000, 15.0000, 16.0000, 17.0000, 18.0000, 19.0000, 20.0000, 21.0000, 22.0000, 23.0000, 24.0000 > math scale samples(), 0.5, samples() : math v_print samples() 0.0000, 0.5000, 1.0000, 1.5000, 2.0000, 2.5000, 3.0000, 3.5000, 4.0000, 4.5000, 5.0000, 5.5000, 6.0000, 6.5000, 7.0000, 7.5000, 8.0000, 8.5000, 9.0000, 9.5000, 10.0000, 10.5000, 11.0000, 11.5000, 12.0000 > > MATH WINDOW samples(), 0, 120, samples() :math v_print samples() 0.0000, 5.0000, 10.0000, 15.0000, 20.0000, 25.0000, 30.0000, 35.0000, 40.0000, 45.0000, 50.0000, 55.0000, 60.0000, 65.0000, 70.0000, 75.0000, 80.0000, 85.0000, 90.0000, 95.0000, 100.0000, 105.0000, 110.0000, 115.0000, 120.0000 > Edited 2024-11-20 13:09 by phil99 |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6289 |
I do have a working tool-chain for MMBasic V5.07.08 so I added Peters line from RC15 to it and sure enough, the DHT22 call failed with any overflow. I then changed to Peter's suggestion if( ( (uint8_t)( ((r >> 8) & 0xff) + ((r >> 16) & 0xff) + ((r >> 24) & 0xff) + ((r >> 32) & 0xff) ) ) != (uint8_t)(r & 0xff)) goto error_exit; and the DHT22 now works again. I am not sure why the addition test is need when a similar one exists a few lines earlier, but there is much I don't understand... Jim VK7JH MMedit |
||||
GAVI Newbie ![]() Joined: 20/11/2024 Location: ItalyPosts: 12 |
Hi everyone, I have two problems: 1) with Raspberry YD-RP2040 everything seems to work but MMCC is unable to transfer files larger than 98k bytes. the other Raspberries work fine. 2) the MSGBOX("a","b","c") function only works up to MMbasic 5.08, the versions I tried (6.00RC8 and RC15) return the error ERROR: INVALID CHARACTER Thanks for the work you are doing. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 8008 |
Hi Gavi, Check the CPU speed that you are using for YD-RP2040. They won't run as fast as the Pico and strange things may happen. I've had them running at about 250MHz but no higher (they would run VGA). Apart from that the CPU is the same. It seems to be that the 16MB flash is too slow as the 4MB boards that are similar to the YD-RP2040 are ok. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
GAVI Newbie ![]() Joined: 20/11/2024 Location: ItalyPosts: 12 |
Thanks for the reply, I'll try some more tests. the problem of the MSGBOX function also occurs on Rasperry Pico. |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2669 |
Tried the MsgBox() example in the 5.08 manual on 6.0RC15, standard PicoMite LCD. At CPU speeds 133 to 400MHz:- Error : Invalid character: Edit> Same at 64MHz. Edited 2024-11-21 22:04 by phil99 |
||||
GAVI Newbie ![]() Joined: 20/11/2024 Location: ItalyPosts: 12 |
hi phil99, if you try to install version 5.08 you will see that it works correctly |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10367 |
V6.00.00RC16 Fixes the bugs MSGBOX HUMID for DHT22 Missing cursor in EDIT PicoMiteRP2350V6.00.00RC16.zip PicoMiteRP2040V6.00.00RC16.zip |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5162 |
Hi Peter, Could you look at the RP2040 cold boot pin assignment please. It seems all (not defined by options or VGA/HDMI/PS2/CONSOLE) pins are set to DIN in stead of OFF. The OFF was very handy (and used in PETSCII ROBOTS 6) to see whether a pin is free to use, or if it has been assigned by anything. Maybe there is technically no difference, but OFF means not in use, and DIN that it is assigned (as a digital input). I can work with DIN as default, but the virgin state OFF had it's benefit. If this is done for compliance with 2350 with it's GPIO bug, then there may be a work around in alias-ing OFF and DIN, and keeping the default at OFF. Regards, Volhout EDIT: sh*t.... I just noticed all WII commands have changed. Petrobot 6 will need additional adaptations. I'll have a lot of re-writing to do. Let's await the user manual, to see what it has morphed in to. Similar for SNAKE, CIRCLE, ROCKS, that all had received WII controller options. I am so glad I did not release these yet. Edited 2024-11-22 05:31 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2669 |
Peter thanks for RC16. MsgBox and Humid working well. I noticed Humid delivers a slightly longer (about 0.5mS I think) "wake" pulse for both types. Hopefully this will reduce the occasional random errors. Testing in progress, so far not a single error. Footnote added 2024-11-22 16:23 by phil99 Humid running about 8 hours. No errors. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6289 |
The DHT22 wake pulse was 1mS which the data sheet lists as a minimum so increasing it to 1.5mS was a good idea. Like Phil, all my testing so far has been successful. Jim VK7JH MMedit |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10367 |
They are set to OFF. Try mm.info(pin gp0) after reboot or re-power |
||||
GAVI Newbie ![]() Joined: 20/11/2024 Location: ItalyPosts: 12 |
Greetings, there are problems with the PRINT@ command. With both PicoVGA and LCD the horizontal coordinates are incorrect. I solved it by using the TEXT command |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |