Minimum input signal duration

Flint10

New Member
Hi folks,

What is the minimum reliable imput signal duration the PICAXE -40x2 is capable of reading?

I am using a 40x2 to read up to 8 midi music notes as input signals. The duration of these notes are approximately 125ms. Would the 40x2 running at 40Mhz be capable of reading these?

I have compiled a program that uses a diode mixer cct and the hintsetup routine using INT0 to interrupt on any note being read, but am having problems 'seeing' any of these events on pinsC.

Any help would be most appreciated.

Cheers,
 

John West

Senior Member
You might want to post your code and circuitry. There are often a lot of variables in time dependent data gathering.
 

Flint10

New Member
Thanks for the prompt reply John.

I haven't got a decent cct to show you yet, but hope that the following description is adequate enough.

The PIC is wired up as per the minimum requirements (plus the resonator) as shown in the documentation with the following added:-

The inputs are generated from a commercial midi file reader which has a ULN2803A as it's output driver.

At the moment I have 5 inputs each with a 10k pullup resistor. Each input is fed into the 5 'pinsC' inputs (pins C.0 to C.4) via (one each) series diode to reduce the possible (zero volts) problem with the midi unit ULN2803A.

The Int0 input (on pin B.0) is from the 5 inputs via series diodes with a single 10k pullup resistor to detect when any of the 5 inputs are triggered. Note: If I ground the inputs manually the system works OK.

I have no other output circuitry at this stage only the PIC output pins (i.e. no darlingtons or fets etc.) There is an led's at each output (pins D.0 to D.4) to show when an output is activated.

My code is:-

init:
setfreq em40
let dirsB = %11111111
input B.0 ;enable B.0 as Int0
let dirsD = %11111111
hintsetup %00010001 ;set up B.0 as Int0 on bit 4 in rising edge interrupt
setintflags %00000001, %00000001 ;set hardware Int0 to interrupt on any event
goto mainloop


interrupt: ;check to see if any input is activated
let b2 = pinsC 'Get input condition 0 to 7 and put into variable b2
hint0flag = 0
hintsetup %00010001
setintflags %00000001, %00000001
return

mainloop:

if b2 = %11111110 then gosub glockset

goto mainloop

glockset:
let pinsD = %00000001
return

Hope this is helpful. I'm fairly new to this but enjoying every minute even if I am slowly loosing my hair....(pulling it out actually.....)

Cheers,
 

Technical

Technical Support
Staff member
Take these two lines:

Code:
let b2 = pinsC              'Get input condition 0 to 7 and put into variable b2
    ...
if b2 = %11111110 then gosub glockset
but you only use C.0 to C.4, so if C.5 to C.7 are not high nothing will work....

Try forcing those bits high in b2 first.

Code:
let b2 = pinsC              'Get input condition 0 to 7 and put into variable b2
let b2 = b2 OR % 11100000
...
if b2 = % 11111110 then gosub glockset
 

Flint10

New Member
Thanks Technical,

I do have the other 3 inputs (C.4 to C.7) high in the cct. i.e. they are all tied high each with 10k pullup resistors.
 

Technical

Technical Support
Staff member
Try this, which is much simpler. You probably don't need the interrupt or diode to int pin at all.

Code:
init:
setfreq em40

let dirsB = % 11111110
let dirsD = % 11111111

mainLoop:

b2 = pinsC
if b2 = % 11111111 then mainloop


if b2 = % 11111110 then gosub glockset

; etc.

goto mainloop

glockset:
let pinsD = % 00000001
return
 
Last edited:

Flint10

New Member
Thanks Technical.

Sorry for some wrong information. I've just realised what I said in my first post.
Yes I did say that I have 5 inputs, but I should have said I have 8 inputs but at the moment I'm only 'looking' at the first 5 input states for triggering the Int0 on pin B.0.

Hope this helps.
 
Top