Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:50 02 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : IR Receive ... odd phenomenon

Author Message
LouisG
Senior Member

Joined: 19/03/2016
Location: Australia
Posts: 129
Posted: 03:45am 04 Jan 2023
Copy link to clipboard 
Print this post

Hi guys,

I'm a MicroMite veteran who is having his first crack at a PicoMite.

My project is to operate 24 relays from a PicoMite, singly or in combination, using an IR remote signal. Pins used will be GP0 to GP23 for the relays, GP24 for the IR receiver. Outputs will be into optocouplers with 1K series resistors.

I built breadboard versions of the IR Tx and Rx. The trial IR Tx works, successfully sending Device code = 1 and Key code = 2 on powerup.

The IR Receive breadboard follows the example in the PicoMite manual 5.07.05, page 30, and with the 9 lines of example code loaded it displayed the above two codes on the console accurately. However, when I added SETPIN code for setting up the 24 digital output pins the receiver stopped receiving the IR codes. See code below.


DIM INTEGER Relay(24)=(-1,1,2,4,5,6,7,9,10,11,12,14,15,16,17,19,20,21,22,24,25,26,27,29,31)
FOR i = 1 to 24 : SETPIN (Relay(i)),DOUT : NEXT

DIM INTEGER DevCode, KeyCode
SETPIN 32, IR
IR DevCode, KeyCode, IRInt

DO
 PAUSE 1000
LOOP

SUB IRInt
 PRINT "Received device = " DevCode "  Key = " KeyCode
END SUB


If I delete or comment out the FOR...NEXT statement in Line 2, the IR code is accurately received, as displayed on the console.

If I leave the FOR...NEXT in, the IR code is not received (although the 24 outputs are properly set to DOUT).

I need both! What am I doing wrong? Any help would be appreciated.

 Louis
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1993
Posted: 03:53am 04 Jan 2023
Copy link to clipboard 
Print this post

Should it be
SETPIN Relay(i),DOUT
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
LouisG
Senior Member

Joined: 19/03/2016
Location: Australia
Posts: 129
Posted: 04:25am 04 Jan 2023
Copy link to clipboard 
Print this post

Thanks Palcal.

I think Setpin is working OK.
Not getting any error messages,
The Outputs are correctly set as DOUT. I checked them from the command line.

-
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 04:36am 04 Jan 2023
Copy link to clipboard 
Print this post

As a test, don't set PIN 31 as an output. There might be some interaction between 31 and 32 as both are analog pins.

You could take it further with all the pins and see if it is only one or a few pins that causes the problem.

I assume you have tested your wiring to make sure there isn't a bridge between 31 and 32?

Jim
VK7JH
MMedit
 
LouisG
Senior Member

Joined: 19/03/2016
Location: Australia
Posts: 129
Posted: 04:58am 04 Jan 2023
Copy link to clipboard 
Print this post

I checked, Jim.

No bridge between 31 and 32.
I removed pin 31 from Setpin array. Still the same phenomenon.

-
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2642
Posted: 04:59am 04 Jan 2023
Copy link to clipboard 
Print this post

An experiment.
What happens if you setup the IR & PAUSE 100 before the DOUTs? Does it stop working?
Does a PAUSE 1 in the For / Next loop help?
 
LouisG
Senior Member

Joined: 19/03/2016
Location: Australia
Posts: 129
Posted: 05:10am 04 Jan 2023
Copy link to clipboard 
Print this post

Will try, Phil99

However, Jim's suggestion jolted my memory of a week ago.
When I set only 4 relays (1 to 4) using Setpin, the IR code was received OK. With the full 24 outputs set it was not received. I just tried it with 4. It worked properly.
It's a place to start looking.

Will investigate yours too, Phil99. Thanks.
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1642
Posted: 05:23am 04 Jan 2023
Copy link to clipboard 
Print this post

Do you have any OPTIONs set that may interfere with setting any pins?

OPTION LIST

Bill
Keep safe. Live long and prosper.
 
LouisG
Senior Member

Joined: 19/03/2016
Location: Australia
Posts: 129
Posted: 06:15am 04 Jan 2023
Copy link to clipboard 
Print this post

No. Option List is empty.

Some more info. I think I've narrowed it down.

Apply Setpin DOUT only for relay outputs 1-4, IR code received OK
Apply Setpin DOUT only for relay outputs 1-5, IR code NOT received.
Apply Setpin DOUT only for relay outputs 6-24, IR code received OK

So Relay 5 output is the culprit.

Another observation: Output 5 outputs 3.3V on powerup. However, when made a DOUT on its own, the 3.3V disappears and the pin behaves normally when set to logic 1 or 0. This could be a defect. I have another Pico with the same Output 5 (GP3) doing the same thing.

Will try to reorganise pin allocations to get it working or get a new Pico.

Thanks everyone for nudging me towards a solution.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 06:23am 04 Jan 2023
Copy link to clipboard 
Print this post

Good to see you making progress.
It would be interesting to see if you can use pin 5 as the IR receive and pin 32 as an output.

Jim
VK7JH
MMedit
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2642
Posted: 07:15am 04 Jan 2023
Copy link to clipboard 
Print this post

Tested 2 Picos freshly flashed with the latest 5.07.06RC1.
GP0 to GP5 all just a few mV.

Could the 3V3 be leakage on the breadboard? Measure that position with the Pico removed.
Or try with the Pico in a different place on the breadboard.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5090
Posted: 07:36am 04 Jan 2023
Copy link to clipboard 
Print this post

Hi LouisG,

Noticed you have a "dummy entry" in your array:

DIM INTEGER Relay(24)=(-1,

Picomite has a nice way to avoid this:

OPTION BASE 1

When using this option the lowest index into the array changes from the default "0" to "1".

Regards,

Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 08:17am 04 Jan 2023
Copy link to clipboard 
Print this post

Unplug the Pico from the breadboard and just wire the IR receiver with flying wires then test. As Phil says there should be no voltage on pins as powered up
 
LouisG
Senior Member

Joined: 19/03/2016
Location: Australia
Posts: 129
Posted: 10:35am 04 Jan 2023
Copy link to clipboard 
Print this post

Matherp and Phil proved to be spot on. I removed the Pico and was astonished to measure a bridge from Pin 6 to Pin 35 on the Vero proto board. All fixed now. Thanks Guys.

-
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025