Jump to content

mess

Programmer
  • Posts

    141
  • Joined

  • Last visited

Everything posted by mess

  1. Hi Stryd, I couldn't find an example there and most of the code over there takes no advantage of the hardware multiplier will this solution work? it first takes the absolute value of the 16bit signed value, does the 16x8 multiply and makes it signed again if someone knows of a better solution let me know (note that the code below is inline assembler called from an interrupt routine) the C equivalent: out[HL] = out[HL] *cutoff /256 ... ;out = out*cutoff/256 (8*16 multiply, keep 2 MS bytes) ; calculate the absolute value of out movff _out_h, _IRQ_TMP2 movff _out_l, _IRQ_TMP1 btfss _IRQ_TMP2, 7 ; if sign bit is not set goto get_abs_pos bra _get_abs_pos _get_abs_neg comf _IRQ_TMP2, F comf _IRQ_TMP1, F incf _IRQ_TMP1, F skpnz incf _IRQ_TMP2, F _get_abs_pos ; multiply lsb of abs(out) with cutoff banksel _cutoff movf _cutoff,W, B mulwf _IRQ_TMP1 movff _PRODH, _IRQ_TMP1 ; multiply msb of abs(out) with cutoff mulwf _IRQ_TMP2 movf _PRODL, W addwf _IRQ_TMP1, F skpnc incf _PRODH, F movff _PRODH, _IRQ_TMP2 ; if out was negative, convert to negative value banksel _out_h btfss _IRQ_TMP2, 7,B ; if sign bit is not set goto mult_end bra _mult_res_pos _mult_result_neg comf _IRQ_TMP2, F comf _IRQ_TMP1, F incf _IRQ_TMP1, F skpnz incf _IRQ_TMP2, F _mult_result_pos movff _IRQ_TMP1, _out_l movff _IRQ_TMP2, _out_h ...
  2. can someone point me to a good tutorial for doing math on a pic? I want to multiply a 8bit unsigned variable with a 16bit signed variable... thanks, Michaël
  3. Thanks, I don't know why I didn't found them there already ::) the snare is fixed, I used a wrong resistor somewhere now I just need to make a little mixer to control the voice levels seperatly :)
  4. Hi I'm building some analog drum voices for my seq... starting with: dr55 kick dr110 snare/hats the kick works ok but the snare doesn't sound right could someone send me a sample of the snare? PM me for my emailaddress... thanks, Michaël
  5. I ran into this some time ago when I was experimenting with processing... (btw processing was fun to get experiment with java, you get instant gratification ;D) the thing I really like about Arduino/Processing is the simple concept It seems a lot simpler to get going and understanding the principles then with midibox stuff. The Arduino manual is a piece of art on it's own :) The arduino project seems to be very suited to get into micros, but I still like midibox better for the real geeky stuff... it's a little harder to grasp the concepts but you can get a lot more out of it Michaël
  6. Lol :)
  7. I guess the only advantage is readability...
  8. I have modified the code to avoid the WREG stuff only to find out that I can't access my programmer until next week :( In the meanwhile the program is running on a core :-) this was a lot of effort for a simple digital noise generator...
  9. the answer to the first question was on page 11 of the datasheet so this one is solved :) only the wreg problem remains...
  10. It seems like the watchdog timer is doing it's job if you code takes too long (too much code or an endless loop) the watchdog isn't reset in time so the watchdog resets the core... maybe you could post the relevant code for the core?
  11. if you want to replace IFSET PIR1, TMR1IF, rgoto IRQ_Timer1 the code should be btfsc PIR1, TMPAIF rgoto IRQ_Timer1 note that you have to use btfsc with IFSET and btfss wit IFCLR you can look into macro.inc for similar conversions for the other instructions I just did what the macro should do ;D hope this helps (and that I'm not telling you stuff you already knew :))
  12. Hi, I'm working on a small 16f88 project in assembler using the speakjet code as template... *Can someone explain the use of SWITCHBANK_...? I understand the banked system with pic18f... with BANKSEL variable but I don't know when to switch banks with a 16f88 my variable declarations: shared_ram udata_shr W_TMP res 1 STATUS_TMP res 1 FSR_TMP res 1 gpr0 udata NOISE res 3 TMP1 res 1 ...and the code without switches IRQ_Handler_NoiseInt ;; noise generator ;; new bit = b18 exor b13 ;; shift NOISE one to the left, insert new bit as LSB ; TMP1 = NOISE >> 2 rrf NOISE, W rrf WREG, W movwf TMP1 ; WREG = NOISE+1 >> 4 rrf (NOISE+1), W swapf WREG, W ; WREG = WREG exor TMP1 xorwf TMP1, W ; carry = LSB of WREG rrf WREG, W ; three byte shift register rlf (NOISE+2), f rlf (NOISE+1), f rlf NOISE, f ; ouput new shift register value to RA2 ; the output value is in the carry flag from last shift bc IRQ_Handler_NoiseInt_Out_1 bcf PORTA, 2 goto IRQ_Handler_NoiseInt_End IRQ_Handler_NoiseInt_Out_1 bsf PORTA, 2 IRQ_Handler_NoiseInt_End goto IRQ_End *I also get a assembler error on WREG (symbol not defined) does anybody knows how to solve this? Michaël
  13. Another option is to handle the shift registers yourself so you can have higher update rates... the update routine could be called from user_timer, you can use the mios source code as an example on how to drive the shift registers this would allow a ledmatrix and shade resolution...
  14. Update: -I've ported the filter code from the avrsynth to the pic, the cutoff frequency can be adjusted manually or modulated with the lfo -Three waveforms are available: sine, square(with pwm) and saw -The lfo modulation amount can be controlled via cc -Eg0 controlls the output amplitude Most of this code was optimised in asm The code is by no means finished or bugfree, but it does generate sound ;D I'm using a 8 bit parallel dac right now, a mx 7228 from maxim (only one channel is used) and after that a 2nd order sallen key lowpass filter to reduce aliasing noise I still need to try out a pwm dac... do I just need to configure the pwm unit and put my output value into the pwm register? this way I could get rid off the external dac also the accumulator should be modified for 24bits to increase the frequency resolution right now the pitch is a bit off @ MyCo I know what you mean with the hardware part :) Have you tried using a virtual ground for the opamps? I have reduced the dac output amplitude to 2,5v together with an opamp powered from 0-5v with a 2,5v virtual ground @ Jaicen: You can always throw away the digital filter/modulation stuff if you don't need it :) Michaël
  15. Here's v0.2 with pwm: webs.hogent.be/~032573mh/coresound_v0_2.zip I used a modified lfo source file from the analog toolbox for this the lfo modulates the PWM amount you can control: initial pwm: cc#10 lfo rate: cc#11 lfo on/off: cc#12 note that this is pwm on the output square wave, the output is still 1bit! the next version will use a 8bit parallel dac (R2R of integrated) connected to PORTB Right now I'm using a integrated dac so that I don't have to solder all of those R's but I guess the R2R from AOUT_LC will do fine... I would connect it straight to PORTB, without the shiftregister I don't think it's possible to implement a filter with the current setup (non optimised C coding) but it sure would be nice to have :) @ Michael Nice work on the speakjet, I have found the frequency calculation part The problem is that the pic has to calculate those 4 sinewaves and mix them together in software wich would require a lot of multiplies... All comments are welcome :-) the approach right now is actually quite simple: increment a 16bit counter with a fixed frequency (2Mhz), the size of the increment determines the frequency take the top byte of the counter and... output straight to dac: saw use as index to a sine table: sinewave compare against a value, if lower output 0 else output 255: square with variable pulse with ... and so on :)
  16. It generates the note you press, you can play any note up to B6... I have a newer version with PWM, you can set initial duty cycle and modulation speed, this sounds a lot more interesting already I don't have a tuner here so I can't comment on accuracy It's really just a toy that's a lot of fun and very easy to make In the meantime, I have found a parallel 8 bit dac, so I can make all kinds of shapes: sine square saw triangle I'm gonna try to implement an envelope tonight... Thanks AC for the links I'm going to look into those... the second one seems like fourrier analyses/synthesis I guess that would be a bit too much for the pic to handle in C :)
  17. Hi, I made a very simple synth out of a core last night, it generates a square wave when you send a note from a keyboard on midi channel one since I didn't have a dac this first version outputs a square wave on J14 the required output circuit: 100n 10k J14---||--\/\/\------------- | | _______ sound out == 10n >/ | _/< 100k pot, log _|_ _|_ you can find the code here: http://webs.hogent.be/~032573mh/coresound_v0_1.zip Michaël
  18. Thanks just what I need :)
  19. Hi, I want to right some custom sysex routines to dump bankstick data can someone point me to a good sysex reference? Michaël
  20. When I first tried to use an encoder I made the same error :)
  21. Hi you also need to add this encoder in mios_tables.inc (in the mios_wrapper subdir) _MIOS_ENC_PIN_TABLE MIOS_ENC_PIN_TABLE ;; encoders 1-16 ;; SR Pin Mode ENC_ENTRY 8, 6, MIOS_ENC_MODE_DETENTED2 ; datawheel Since you only have one encoder this encoder has number 0 (first entry in the table) Did you define DATAWHEEL_SPEED_MODE and DATAWHEEL_SPEED_DIVIDER somewhere? in the clockbox example these are defined in main.h but this file isn't included in the skeleton Michaël
  22. Hi a7thson, thanks for the link, I've been looking for something like this for some time now :) Michaël
  23. mess

    Clockbox

    Hi Ziggy, here's a first version, you can divide the bpm by 1,2,3,4 (more divisors are possible) since I didn't want to change my existing hardware I've made some changes to the handling: * the play button now acts as a play/pause button * the pause button cycles through the encoder modes: BPM, track select, divisor select (for selected track) it's possible to add a multiplier (change resolution to 96ppq, divide the normal output by 4) but I don't have the time to implement this now... I hope the version with division will be useful: clockbox_v1_1_w_divison.zip If you have questions about the code just ask :-) Michaël
  24. mess

    Clockbox

    Hi Ziggy, I will post an example tomorrow (only tempo division), do you need the features from v1.1? (eg MTC support) using the v1.0 makes it a bit easier to code :)
  25. Hi Michaël I recompiled (modified) speakjet code some time ago and it did work I did use WinPIC800 with a JDM programmer, maybe it's a problem with PBrennerNG? If you send me the code I will try to burn it here...
×
×
  • Create New...