Posted: 11:37am 21 Sep 2022 |
|
|
|
Problem solved! Left it for a few days but tried it again after loading Peter's release of V5.07.05RC1 last night. The same problem i.e. the RUN command returning a "[" to the console and then hanging, was still there so I tried some other changes. Turns out the position of the PWM statement was the problem. My setup has Pin 4 (PWM out) directly connected to Pin 9 (count in) as a high resolution timer to decode 433MHz transmissions a la TassyJim and Disco4now, so it may be a particular case.
Original code.
' Pico Pin Settings Const highrestimer = 9, receiveblip = 11 'Pico pins 9 & 11 (GP6 & GP8) SetPin 4, PWM1A PWM 1,10000,50 'PWM1A pin 4 out to high resol'n timer on counting pin 9 (GP6). SetPin 9,CIN 'input (counting) pin for the high resolution timer. SetPin 11,INTL,blip 'input (receive) pin for data out (DO) of the 433MHz receive module. SetPin 16,17,I2C 'DA & CLK pins for the BME280
Changed code - as noted.
' Pico Pin Settings Const highrestimer = 9, receiveblip = 11 'Pico pins 9 & 11 (GP6 & GP8) SetPin 4, PWM1A SetPin 9,CIN 'input (counting) pin for the high resolution timer. SetPin 16,17,I2C 'DA & CLK pins for the BME280 Note: ' The "SetPin 11,INTL,blip" statement was moved to just before "Main" do loop. ' but DID NOT fix the problem.
' The "PWM 1,10000,50" statement was then moved to just before "Main" do loop. ' and DID fix the problem.
'============================================================= ' Main - modified as above and now working correctly. '============================================================= CLS RTC gettime Pause 100 PWM 1,10000,50 'PWM1A pin 4 out to high resol'n timer on counting pin 9 (GP6) drawgrids Blit read #1,MM.HRes-90,60,60,200 'store the blank scrolling area of the screen. bme280_init 'must be run before pressure or humidity SetTick 30000,BME 'read presuure every 30 secs. SetPin 11,INTL,blip 'interrupt receive pin for data out (DO) of the 433MHz module. Print Print "BME`C BME%RH BMEHg Ch1`C Ch1%RH Ch2`C Ch2%RH" Do Loop '--------------------------------------------- I couldn't see anything in the manual about this being something to watch out for but it might be a good idea to mention it.
Greg |