audiocommander Posted May 25, 2006 Report Share Posted May 25, 2006 sorry, I know there are some threads about the DOUTs, but I'm having trouble getting my DOUT module to function.I connected two LEDs on line 30 and 31 of 1 DOUT module, connected to J8 of CORE (that's because I plan to bring some more LEDs on the other outputs...). I have no DIN module.As soon as I'm calling [tt]MIOS_SRIO_NumberSet(4);[/tt] my application won't be executed properly anymore. Every second pin of the DOUT is lighted, though.If I comment this line out, everything works fine, but naturally all DOUTs are low.This is my init:MIOS_SRIO_UpdateFrqSet(1); // ms, shift register update frequency MIOS_SRIO_NumberSet(DOUT_SR_NUM); // number of shiftregisters (4 per DIN/DOUT module!) and that's on SR_Service_Prepare: void SR_Service_Prepare(void) __wparam { // called every ms // handle DOUT LEDs if(lastAinPin > 0 && lastAinPin < 3) { // distance sensor LEDs on AIN 1 & 2 if(lastValue[lastAinPin] >= 20) { MIOS_DOUT_PinSet((lastAinPin + 29), 1); } else { MIOS_DOUT_PinSet((lastAinPin + 29), 0); } } }I simply want to switch on a LED if the sensor receives a signal.Is this because I have no DIN?Do I have to ground some pins I'm not aware of?Have I totally misunderstood the DOUT-concept? ???Any hint appreciated!Cheers,Michael Quote Link to comment Share on other sites More sharing options...
stryd_one Posted May 25, 2006 Report Share Posted May 25, 2006 *scratches his head*is DOUT_SR_NUM really defined as 4 ?Maybe see if hardcoding some of it helps?I'm puzzled... Quote Link to comment Share on other sites More sharing options...
audiocommander Posted May 25, 2006 Author Report Share Posted May 25, 2006 haha, I'm scrating mine, too (since a few hours now, already beginning to loose hair) ;DThanks for your answer, stryd_one!I also tried [tt]4[/tt], even 8 and MIOS_SRIO_SRSet(4), but no luck so far...Maybe I have to add that I use J14 as DIN:[tt]// DIN ConfigMIOS_SRIO_TS_SensitivitySet(0x00); // TS disabled => Pin RD.4 (J14 Core) is free[/tt]But afaik this shouldn't be the problem? Or is it?Humm... Quote Link to comment Share on other sites More sharing options...
TK. Posted May 26, 2006 Report Share Posted May 26, 2006 No, using J14 as input cannot cause such problems.Have you ever checked that your DOUTX4 module is working? E.g., with MIDIO128 or the DOUT test application?Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
audiocommander Posted May 26, 2006 Author Report Share Posted May 26, 2006 Thank you for that quick answer;So this obviously points to a hardware issue... I'll try a fresh DOUTX4 module tomorrow morning...Seems like I'm really going to need this thing, because me (the greatest electronician of all {attention:irony!}) just found out, that the electric field of a 12V-translucent lightbulb creates enough interference to be detected by a skin resistance sensor with a grid of steel in a 30 cm range. That's a really interesting way to make music (you know, like Luke Skywaker with his light-sword...), but damn, I should've known this and that exhibition is on saturday... now I really need to exchange that fuc*in lightbulb with LEDs :P ... and if I'm using LEDs anyway, it would be sooo funky if I could get my app to control the lights...(I'll send pictures on this next week, because it actually would be the completion of my first MIOS based "Midibox" ;D )So thanks again for the input on my output, have to sleep over it, keep you updated ...Michael Quote Link to comment Share on other sites More sharing options...
audiocommander Posted May 26, 2006 Author Report Share Posted May 26, 2006 well, this is really strange.I just connected a fresh DOUT board and had the same issues.If the shiftRegister is enabled by [tt]MIOS_SRIO_NumberSet(4)[/tt], my sensorizer-code isn't executed anymore, but astonishingly the "normal" AIN-Pot->CC is executed. And moreover, the DOUT works as expected!While if the shiftRegister is disabled, the sensorizer-code works as expected but the DOUT won't do it (obviously because no SRIO active).I think that means it's a software issue and that my sensorizer calculations (which are a bit excessive, I admit ;D ) get somehow interrupted (aborted) by the SRIO, right?I tried to increase [tt]MIOS_SRIO_UpdateFrqSet[/tt] from 1 to 20ms, just to see what happens, but the behaviour did not change.I have three sensors connected to AIN 0-2, grounded pin 3 and four 10k-pots @ AIN 4-7.FYI I enclosed the relevant sensorizer code: void ZS_SENSORIZER_Sensorize(unsigned char pin, unsigned int pin_value) { unsigned char c = 0; unsigned int i = 0; unsigned char sevenBitValue= 0; // 0..255 unsigned int tenBitValue = 0; // 0..1023 signed int invertedValue = 0; // inverter var // read input if(sensor[pin].enabled == 0) { return; } // check pedal state if(sensor[pin].pedal) { if(MIOS_DIN_PinGet(BUTTON_AIN_PEDAL)) { // pedal is +5V => is NOT pressed return; } } // read 10bit input value tenBitValue = MIOS_AIN_PinGet(pin); // check threshold if(tenBitValue <= senseThreshold[pin]) { return; } // invert if(sensor[pin].invert) { invertedValue = tenBitValue - tenBitValue - tenBitValue; tenBitValue = invertedValue + 1023; } // + AINS if(pin >= SENSOR_NUM) { // send 7bit value sevenBitValue = tenBitValue >> 3; ZS_SENSORIZER_SendCC(pin, sevenBitValue); return; } // + GATE if(sensor[pin].gate) { // check timeout if(sensor[pin].read) { // reset gate timeout sensor[pin].read = 0; gateCounter[pin] = 0; } else { return; } // check gate threshold if( (tenBitValue < (lastValue[pin] + gateThreshold[pin]) ) && (tenBitValue > (lastValue[pin] - gateThreshold[pin]) ) ) { // save last 10bit value and abort last10bitValue[pin] = tenBitValue; return; } else { // save last 10bit value and go on... last10bitValue[pin] = tenBitValue; } } // + EXPANDER if(sensor[pin].expand) { // check smin threshold if(tenBitValue < smin[pin]) { sevenBitValue = 0; } else { // interpolate tenBitValue = tenBitValue - smin[pin]; switch(sfactor[pin]) { case 1: i = tenBitValue; break; case 2: i = tenBitValue >> 1; break; case 4: i = tenBitValue >> 2; break; // preferred case 8: i = tenBitValue >> 3; break; case 16: i = tenBitValue >> 4; break; default: i = ZS_MATH_Divide(tenBitValue, sfactor[pin]); break; } if(i > 127) { i = 127; } sevenBitValue = i; } } else { // don't expand, just read 7bit sevenBitValue = MIOS_AIN_Pin7bitGet(pin); } // scale if(sensor[pin].scale) { c = ZS_MATH_Scale_7bit(sevenBitValue, tmin[pin], tmax[pin]); sevenBitValue = c; } // send MIDI message ZS_SENSORIZER_SendCC(pin, sevenBitValue); return; } Any suggestions very welcome :)I'm a bit clueless right now... Quote Link to comment Share on other sites More sharing options...
audiocommander Posted May 26, 2006 Author Report Share Posted May 26, 2006 OOhhhh, how sorry I am...This turned out to be a silly error!!!Checking the code again, I found that I wanted to get the state of a DIN-pin (checking the pedal), which is not available (of course, no DIN-board!).Bad code-reusing at big tomatoes on my eyes!Sorry to steal your time, but at least the typing helped me to think straight!:D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.