Strange 18M2 beavior

cachomachine

Senior Member
I have a HC-SR04 connected to pin C.6 (Trigger) and C.5 (Echo) of a 18M2.
As long as i keep B.4 low, the HC-SR04 keeps reading the distance correctly, if i turn b.4 high, the HC-SR04 stops reading and pulsin command times out.(even with the B.4 pin floating in the air)
Turning any other ''B'' pin ON does not cause this problem.
B.4 is used to turn ON a LED (connected to the cathode through a 100 ohm resistor)
Is it there a relation between C,5,C.6 and B.4 ? or do I have a defective 18M2 ?
My program is as simple as possible:

#picaxe 18M2
#no_data
start0:
dirsb=%11011111
dirsc=%10001111
pinsb=%00000111

main: pulsout c.6,4 '10us pulse
pulsin c.5,1,w1 ' Get response
debug
goto main

Any tought
 

cachomachine

Senior Member
I have moved the 18M2 to a breadboard with only gnd, 5v, c.5, c.6, serial in and serial out eliminating the hardware issue and i have exactly the same behavior, must be a deffective 18M2, onfortunately i do not have another 18M2 to try.
 

Revolvr

New Member
Whenever I've seen really weird behavior in a PICAXE, it is always because I forgot to ground the serial IO pins. Check that first.
 

cachomachine

Senior Member
Serial IO are connected to the programming cable and are displaying debug results, I have learned a long time ago that you cannot let a serial in pin floating neither can you let a reset pin float
Also have decoupling and bulk capacitors fitted, 104 and 1000U on each side of regulator.
 
Top