-
Posts
15,253 -
Joined
Content Type
Profiles
Forums
Blogs
Gallery
Everything posted by TK.
-
Hi Chriss, (this is not a programming specific answer, but I guess that you can excuse me, that I cannot dictate the code for all possible modifications due to time reasons...) the assumption that each LED consumes 20 mA is wrong. One point is, that the max. current is limited by the 74HC595 (80 mA maximum), another point is, that the LEDs are not completely saturated due to the 220 Ohm resistor... in practice the current is mostly about 10mA Best Regards, Thorsten.
-
Maybe this application gives you more freedom for your personal whishes? ;-) http://69.56.171.55/~midibox/forum/index.php?topic=5080.0 Best Regards, Thorsten.
-
Hi Gerald, does it work better with following line: set SDCC_DEFINES="-DDEBUG_MODE=0" similar things have to be done in tools\make_sub.bat If this doesn't help, then it's maybe better when I'm writing some kind of makefile generator, which doesn't get use of such special tricks The Analog Toolbox is now released, the description can be found here: http://69.56.171.55/~midibox/forum/index.php?topic=5080.0 Best Regards, Thorsten.
-
now available at http://www.ucapps.de/mios_download.html from the README.txt Analog Toolbox V1.1 (C) 2005 Thorsten Klose (tk@midibox.org) =============================================================================== This application allows to output analog values at the AOUT module depending on analog values, MIDI events and internally generated waveforms It's definitely not a professional tool, but just a toy for having some fun! Everybody is welcome for sharing additional modules and/or processing algorithms to the MIDIbox community! =============================================================================== A precompiled binary is already part of this package: o project.hex (can be loaded into MIOS Studio) o project.syx (can be loaded into any SysEx upload tool) Following tools are required to recompile the code: o SDCC v2.5.0 o gputils o perl The details are described under http://www.ucapps.de/mios_c.html =============================================================================== Required hardware: o one MBHP_CORE module o one MBHP_AOUT module Optional hardware (not supported by default, but provided by MIOS): o up to 2*AINX4 for up to 64 analog inputs (reduces the sampling frequency!) o up to 4*DOUTX4 for up to 128 digital outputs o up to 4*DINX4 for up to 128 digital inputs o LCD - but note that it affects the realtime performance! o up to 8 BankSticks to store waveforms or other tables =============================================================================== Configuration steps: o check the "general application settings" in main.h if changes are required for your hardware setup By default 8 analog inputs are used in "UnMuxed mode" (direct connection to CORE:J5 without AINX4 modules) Remember: unusued analog pins on the CORE module should be clamped to ground! o check the pin configuration for the AOUT module in aout.h The default pinning is equal to the pinning used by MIDIbox CV o open map.c and adapt the "signal processing" for your needs o the application can be rebuilt with the "make.bat" file (type "make" in a DOS command shell) =============================================================================== Description about the most important files: - mios_wrapper\mios_wrapper.asm and mios_wrapper\mios_tables.inc: The MIOS wrapper code and MIOS specific configuration tables - pic18f452.c: exports PIC18F452 specific SFRs - main.c: the main program with all MIOS hooks - aout.c: the AOUT module driver (1) - midi.c: the MIDI processing module (2) - lfo.c: provides two digital LFOs (3) - eg.c: provides an envelope generator (4) - map.c: handles the "signal processing" (analog output values are determined here) (5) There are additional .h files for all .c files which contain general definitions and the declaration of global functions/variables These .h files must be included into the program parts which get use of these globals ------------------------------------------------------------------------------- (1) aout.c this module provides following global variables: unsigned int aout_value[8] (12bit value) accessible with: aout_value[0] for the first AOUT aout_value[1] for the second AOUT ... aout_value[7] for the 8th AOUT aout_gates_t aout_gates (union with two elements: G0 and G1) accessible with: aout_gates.G0 for the first gate on the AOUT module aout_gates.G1 for the second gate on the AOUT module value changes will lead to an automatic update on the AOUT module ------------------------------------------------------------------------------- (2) midi.c this module provides following global variables: midi_note_t midi_note[16] (union with two elements: NOTE and GATE) midi_note[0] for the first MIDI channel midi_note[1] for the second MIDI channel ... midi_note[15] for the 16th MIDI channel Union usage: midi_note[x].NOTE returns the note number (0-127), midi_note[x].GATE returns the gate state (0 or 1) unsigned char midi_cc_chn0[128] for CC values received on MIDI channel #1 Examples: midi_cc_chn0[1] returns the ModWheel Value midi_cc_chn0[7] returns the Volume midi_cc_chn0[10] returns the Pan position midi_cc_chn0[11] returns the expression value unsigned int midi_pitch_bender[16] for Pitch Bender values ------------------------------------------------------------------------------- (3) lfo.c By default two digital LFOs are provided, the selectable rate goes from 0.016 Hz to 97.4 Hz (see lfo_table.inc) - however, above 20 Hz the generated waveform doesn't look so nice anymore on the scope due to quantisation effects (on the other hands: some people drool for such effects ;-) The LFOs generate a sawtooth waveform, which can be easily transformed into other waveforms by using a waveform table (map.c contains an example, how to convert this saw into a sinewave) The LFOs are clocked from the USER_Timer() process each 1 mS (see timer configuration in main.c) Following global variables are available: unsigned char lfo0_rate, lfo1_rate the LFO rate from 0..255 unsigned int lfo0_value, lfo1_value the LFO waveform from 0..65535 (16 bit) ------------------------------------------------------------------------------- (4) eg.c By default one digital ADSR envelope generator is provided, the selectable attack/decay/release rate goes from 1 mS to 2731 mS (see eg_table.inc) The EGs is clocked from the USER_Timer() process each 1 mS (see timer configuration in main.c) Following global variables are available: eg_state_t eg0 provides the gate: eg0.GATE = 1 to set, = 0 to clear unsigned int eg0_value the EG value from 0..65535 (16bit) unsigned char eg0_attack, eg0_decay, eg0_sustain, eg0_release the ADSR values from 0..255 ------------------------------------------------------------------------------- (5) map.c Thats the central file where incoming and internal values are routed to outgoing values (aout_value[0..7], ...) Please read the file to get some inspirations Note that sometimes values need to be converted depending on the resolution. For better readability, some macros have been defined which can be found in aout.h Example: aout_value[0] is a 12bit value, MIOS_AIN_PinGet(0) delivers a 10-bit value. In order to convert this to a 12bit value, just use the CONV_10BIT_TO_12BIT macro: aout_value[0] = CONV_10BIT_TO_12BIT(MIOS_AIN_PinGet(0)); so that the most significant bit of the 10bit value is aligned to the most significant bit of the 12bit value (in fact the value is multiplicated by 4, resp. it is leftshifted 2 times) Additional notes to digital inputs and outputs: if DINX4 and/or DOUTX4 modules are connected, the number of shift registers have to be defined in main.c, function USER_Init() in the following way: MIOS_SRIO_NumberSet(4); // for 4 shift registers Thereafter you can get digital values with: MIOS_DIN_PinGet(<pin-number>) and set values with: MIOS_DOUT_PinSet(<pin-number>, <value>) Additional notes to module extensions: MIOS provides some hooks which could be useful for some special jobs, e.g. MIDI clock processing. This example demonstrates, how to add a MIDI clock handler: a) open main.c, search for the MPROC_NotifyReceivedByte function and add following lines: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void MPROC_NotifyReceivedByte(unsigned char byte) __wparam { if( byte == 0xf8 ) // MIDI clock has been received MAP_MIDIClock(); // call MAP_MIDIClock to notify this } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b) open map.h, search for "prototypes", and add the function declaration here: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void MAP_MIDIClock(void); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - c) open map.c, go to the bottom and add following lines: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void MAP_MIDIClock(void) { // do anything here } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - =============================================================================== [/code] Best Regards, Thorsten.
-
Hallo Jan, das macht Sinn - besten Dank fuer den Hinweis! Scheinbar befindet sich der Fehler nur in mbhp_lcd und mbhp_mf, ich habe es geaendert und werde es mit dem naechsten Boot von Windows ausprobieren Gruss, Thorsten.
-
Hi Martin, whoops - you are right. I oversaw that the LEDs are not MIDI controllable in this application. However, just open main.asm, search for following comment: USER_MPROC_NotifyFoundEvent ;; here we could insert code which switches the LEDs on/off via ;; MIDI return [/code] Replace it by: [code] USER_MPROC_NotifyFoundEvent ;; entry number is in WREG --- it corresponds to the LED which should be switched ;; the note velocity (or CC value) switches on/off the LED, it's stored in MIOS_PARAMETER3 IFSET MIOS_PARAMETER3, 6, call MIOS_DOUT_PinSet1 ; set LED if value >= 64 IFCLR MIOS_PARAMETER3, 6, call MIOS_DOUT_PinSet0 ; clear LED if value < 64 ;; thats all return In order to prevent that a button controls a LED, search for "USER_DIN_NotifyToggle" and remove following code: ;; now toggle the appr. DOUT LED movf TMP3, W ; button number has been saved in TMP3. This is also the LED number IFCLR TMP4, 0, call MIOS_DOUT_PinSet1 ; if button has been pressed (value = 0V = CLR): LED on IFSET TMP4, 0, call MIOS_DOUT_PinSet0 ; if button has been depressed (value = 5V = SET): L ED off [/code] Best Regards, Thorsten. P.S.: sometimes I don't know why I'm writing comments... ;-)
-
No, such util routines are not available yet (they consume a lot of CPU time and they are very LCD specific) Best Regards, Thorsten.
-
Hi Gerald, I used the good old DOS batch language which is documented here: http://home.att.net/~gobruen/progs/dos_batch/dos_batch.html (I used it, because all Unix-style make.exe programs I found cannot handle properly with path variables - it causes even more issues with all windows versions) DOS batch should be compatible with all DOS/windows versions, but a potential problem is, that the PATH variables to sdcc and the gputils is not configured correctly. In WinXP this is done automatically during the installation. So far I remember in previous windows versions this has to be done in C:\AUTOEXEC.BAT Are you able to start "sdcc", "gpasm" and "gplink" from the command line? However, today I wrote some low-level AOUT functions for the C wrapper, it works very well and especially very fast (because they are assembly optimized ;-)) I've also prepared some small C programming examples which demonstrate the possibilities: forward/processing incoming MIDI events to AOUTs forward/processing AIN values to AOUTs generate waveforms at the AOUTs (AOUT = f(t)) transform incoming waveforms to new waveforms (AOUT = f(x)) set gate outputs depending on AIN levels hope that this gives enough inspirations - once I find the time to write some documentation, I will release it (maybe tomorrow if nothing else happens) Best Regards, Thorsten. P.S.: the programming effort to realize this was 2 hours so far ;-)
-
PICs prommen / welche uC-apps-ware soll ich für SID & CV-Converter nehmen?
TK. replied to alisa 1387's topic in Deutsch
Von der Softwareseite her ist alles ganz einfach: in cv_map.inc findest Du den Kommentar "convert note to 12bit value". Hier wird der Notenwert einfach um 5 stellen nach links geshiftet. Stattdessen kann man den Wert auch aus einer Tabelle herauslesen (es gibt ja nur 128 verschiedene Moeglichkeiten), und den entspr. 12bit Wert direkt in die CV_AOUT_H und CV_AOUT_L Register uebertragen. Das sind vielleicht 10 Assemblerzeilen Problematisch wird es jedoch mit dem Pitchbender. Falls ein nichtlineares Verhalten akzeptabel ist, einfach den Code so belassen, ansonsten benoetigt man eine groessere Tabelle. Bei 2^12 waeren das 8k, das passt bei der MBCV noch problemlos ins Flash. Man koennte auch mehrere Tabellen in einen BankStick ablegen, dies waere sehr praktisch, um zwischen verschiedenen Mappings umzuschalten, ohne den PIC neu zu programmieren. Die Tabellen sollte man natuerlich vorberechnen (bspw. mit Perl, siehe das frqtab.pl Skript im MIDIbox FM Package) Von der Hardwareseite her weiss ich nicht, ob es die 12bit bringen. Die Referenzspannung des MAX525 betraegt 2.048V, 4.096V ist laut Datasheet nicht empfehlenswert, doch die Ausgangsspannung sollte sowieso gepuffert werden, somit empfielt sich ein nachgeschalteter OP mit 1:2 Spannungsverstaerkung. Bei 12bit Aufloesung folgt daraus eine Genauigkeit von 4.096V/2^12 = 1 mV reicht diese Genauigkeit? Gruss, Thorsten. -
Sid: led for active submenu (osc, env, fil, etc.)
TK. replied to OnAcid's topic in MIOS programming (Assembler)
Great! :) Best Regards, Thorsten. -
ok, if you want to use two cores anyhow, the solution is much simpler: just open mios_tables.inc in the AIN64DIN128DOUT128 application and replace 0xb0 (CC) by 0x90 (Note) Then add following line to USER_Init: MIOS_MIDI_MergerSet(MIOS_MIDI_MERGER_MBLINK_FP) to configure this core as a "forwarding point" or: MIOS_MIDI_MergerSet(MIOS_MIDI_MERGER_MBLINK_EP) to use it as an "endpoint" Best Regards, Thorsten. P.S.: don't forget to clamp all unused analog inputs to ground (for the DIN/DOUT core this means: the whole J5 port)
-
Hi Gerald, by using the MIOS C skeleton it shouldn't be that difficult to realize a quantizer, simple sequencer or whatever you want. In difference to assembly programs, sharing code with other users is much easier. So, how about a MIOS user library, a collection of some interesting functions and "program-modules", maintained by users and not by myself? Best Regards, Thorsten.
-
Hi Julien, if up to 8 buttons are enough, then you could use the j5_din application. It requires only one core module, the buttons have to be connected to port J5 - it can send any MIDI events you want (by default Note events) For more then 8 buttons (or additional LEDs), a DIN and DOUT module is required beside of the core, MIDIO128 is the recommented application for this case Best Regards, Thorsten.
-
thank you, Marcel! This sounds easy. For a common MIOS based application this means that in USER_MIDI_NotifyTx a check for MIDI clock (F8) has to be added (if it doesn't already exist). On an incoming MIDI clock, MIOS_DOUT_Set1 has to be called with the pin number which is used as sync output. Optionally a pre-divider can be added. In USER_SR_Service_Finish this pin has to be cleared (MIOS_DOUT_Set0) - and thats all. This will generate a pulse of 1 mS, with a jitter of +/- 0.5 mS. I think that such a jitter is acceptable, because it is only 1% at 140 BPM (I will integrate this feature into the next MBSEQ release) If less jitter is required, a free IO pin has to be used (but free IOs are rare). This IO pin can be set immediately once a F8 event has been received (zero jitter!), and it can be cleared by a timer. However, this requires some more programming effort, and the code will look different depending on the application where it is integrated (because of different pin usage and timer resources) For a standalone solution I would prefer Colin's circuit, it's the cheapest Best Regards, Thorsten.
-
Last time I saw this source code, it didn't find any SIDstation, nor general MIDI routines - are such features available in the meantime? Best Regards, Thorsten.
-
Sid: led for active submenu (osc, env, fil, etc.)
TK. replied to OnAcid's topic in MIOS programming (Assembler)
Hi, you could control the additional LEDs in cs_menu_leds.inc, example: CS_MENU_LED_Update clrf MIOS_PARAMETER1 ; clear LED by default movf CS_MENU, W xorlw CS_MENU_OSC skpnz setf MIOS_PARAMETER1 ; set LED if CS_MENU == CS_MENU_OSC movlw 8*(7-1) + 0 ; SR7, pin #0 call MIOS_DOUT_PinSet [/code] Best Regards, Thorsten. -
I could give you a small C function which allows you to control all 128 LEDs, I just need to know which MIDI events should be assigned to the LEDs? Best Regards, Thorsten.
-
Hi Alex, do you know how to get a (free) datasheet for this chip? If you've luck, the internal functions and the SFR addresses are the same - if not, an adaption wouldn't be worth the effort Best Regards, Thorsten.
-
Hi Davo, I made some experiemts with a self-built oscillator some time ago (based on three inverters), but the results where not so good - sometimes the oscillator didn't start after power-on. If you are still interested, I can search for the schematic (I guess that I found it on a german website) However, for the MBSID the oscillator is not required, you can also clock the SIDs with the PWM output of the PIC - more infos can be found here: http://www.ucapps.de/mbhp_sid.html Best Regards, Thorsten.
-
Chriss added the code for the additional buttons and LEDs to the MBSID application, there are no changes in MIOS required. I guess that the question "are they really necessary?" is directed to Chriss (because I don't know anybody else who uses such an extension). If he doesn't read this posting, then just try to contact him via PM Best Regards, Thorsten.
-
Hi, it's very simple to implement this, but last time I asked in the forum for the specs, I havn't got a reply. So, maybe this time I've more luck? What is the required pulse width for a DIN-Sync signal? Best Regards, Thorsten.
-
Hi, I fear that it isn't possible to service the SHX8 module in parallel to all the other tasks which are running in the MBSEQ application, because the S&H outputs need to be refreshed very often. I would suggest the use of a second core which runs with the MB64 firmware and which handles the S&H stuff Best Regards, Thorsten.
-
Hi Dave, yes, thats possible with Meta Events (you can send anything you want...). The MB64 (and MB64E) source code contains an example in mb64_meta.inc (mb64e_meta.inc), there are users who already customized this for their synths, but I guess that there is no adaption for DW-8000, yet Best Regards, Thorsten.
-
Is there somebody who wants to create a webbased java application which calculates possible configurations? ;-) here some formulas: max number of available digital inputs: 128 max number of digital inputs which can be used to trigger button functions (e.g. MIDI events or Special Functions): 64 number of digital inputs which can be used for menu navigation: 4 number of digital inputs which are allocated for encoders: 2 * number of encoders (max. 64 encoders = 128 pins) max number of analog inputs: 64 number of 7-bit MIDI values which are stored within a bank, and which can be controlled via encoder or AINs: 128 number of 1-bit MIDI values which are stored within a bank, and which can be controlled via DINs: 64 max number of available digital outputs: 128 number of digital outputs which are controlled directly via button or via MIDI (same MIDI events like assigned to the 64 buttons): 64 max number of digital outputs which can be used for LEDrings: 32 for each group of 16 LEDrings, max: 64 LEDrings = 128 pins number of digital outputs which can be used as software-based MIDI Tx/Rx indicator: 2 pins anything missing? Best Regards, Thorsten.
-
Hi Matteo, it should work with MIOS v1.7, but I cannot guarantee this, since all of my own MIDIboxes are running with v1.8 in the meantime Best Regards, Thorsten. P.S.: thanks for the postcard! :-)
