Jump to content

stryd_one

Frequent Writer
  • Posts

    8,840
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by stryd_one

  1. TR808's are analog?! :P hehehhe I know all that stuff... But I was just hoping....
  2. What about programming the sounds via MIDI?
  3. Well lets look at what they do: AOUT from Toolbox: SCLK Low CS Low : Load the bits loop DIN Low DIN High (if the bit is set) Shift bits SCLK High Shift bits again to keep SCLK high for long enough to keep the MAX525 happy SCLK Low :Do the loop until they're all loaded CS High Now AOUT_LC from MBCV: SCLK Low : Load the bits loop DOUT Low DOUT High (if the bit is set) SCLK High SCLK Low Shift bits :Do the loop until they're all loaded RCLK High DOUT Low RCLK Low ....I'm pretty sure that's what my last code does? But I'm not sure the bits are being shifted off correctly :\
  4. I wasn't so sure about the clocking either... try this: void AOUT_Load2SR(unsigned int sr0_value, unsigned int sr1_value) { aout_sr0 = sr0_value; aout_sr1 = sr1_value; __asm bcf AOUT_LC_LAT_SCLK, AOUT_LC_PIN_SCLK ; clear clock COPIED FROM MBCV DRIVER ;; bcf AOUT_LAT_CS, AOUT_PIN_CS ; activate chip select NOT NEEDED FOR AOUT_LC ;; I believe that the below might be able to be ignored for the AOUT_LC? ;; you will notice that the instructions are sometimes arranged ;; in a special order to ensure proper output signals - for example: ;; between a rising and a falling SCLK edge there is at least one ;; other instruction to ensure that the high pulse of the SCLK ;; is longer than 100 nS (the MAX525 datasheet specifies at least 40 nS) banksel _loop_ctr movlw 16 ; init loop counter ONLY 16 BIT FOR _LC movwf _loop_ctr, BANKED ;; This is the same as the original AOUT driver with the names changed, and the latching copied from the MBCV AOUT_Load2SR_Loop: banksel _aout_sr0 bcf AOUT_LC_LAT_DOUT, AOUT_LC_PIN_DOUT ; set DOUT depending on current MSB btfsc _aout_sr1+1, 7, BANKED bsf AOUT_LC_LAT_DOUT, AOUT_LC_PIN_DOUT rlcf _aout_sr0+0, F, BANKED ; start to shift the 16-bit value rlcf _aout_sr0+1, F, BANKED ; second step for the 16-bit shift rlcf _aout_sr1+0, F, BANKED ; third step for the 16-bit shift rlcf _aout_sr1+1, F, BANKED ; last step for the 16-bit shift bsf AOUT_LC_LAT_SCLK, AOUT_LC_PIN_SCLK ; rising clock edge MOVED FOR AOUT_LC DRIVER bcf AOUT_LC_LAT_SCLK, AOUT_LC_PIN_SCLK ; falling clock edge banksel _loop_ctr decfsz _loop_ctr, F, BANKED ; loop 16 times ONLY 16 BIT FOR _LC bra AOUT_Load2SR_Loop ;; bsf AOUT_LAT_CS, AOUT_PIN_CS; deactivate chip select NOT NEEDED FOR AOUT_LC bsf AOUT_LC_LAT_RCLK, AOUT_LC_PIN_RCLK ; latch SID values COPIED FROM MBCV DRIVER bcf AOUT_LC_LAT_DOUT, AOUT_LC_PIN_DOUT ; clear out pin (standby) COPIED FROM MBCV DRIVER bcf AOUT_LC_LAT_RCLK, AOUT_LC_PIN_RCLK ; release latch COPIED FROM MBCV DRIVER __endasm; } Of course you can rename the variables just make sure they're all the same... And just make sure the AOUT_LC lines are connected to the correct pins :) Oh yeh, are you using one _LC or two?
  5. How's this: void AOUT_Load2SR(unsigned int sr0_value, unsigned int sr1_value) { aout_sr0 = sr0_value; aout_sr1 = sr1_value; __asm bcf AOUT_LC_LAT_SCLK, AOUT_LC_PIN_SCLK ; clear clock COPIED FROM MBCV DRIVER ;; bcf AOUT_LAT_CS, AOUT_PIN_CS ; activate chip select NOT NEEDED FOR AOUT_LC ;; I believe that the below might be able to be ignored for the AOUT_LC? ;; you will notice that the instructions are sometimes arranged ;; in a special order to ensure proper output signals - for example: ;; between a rising and a falling SCLK edge there is at least one ;; other instruction to ensure that the high pulse of the SCLK ;; is longer than 100 nS (the MAX525 datasheet specifies at least 40 nS) banksel _loop_ctr movlw 16 ; init loop counter ONLY 16 BIT FOR _LC movwf _loop_ctr, BANKED ;; This is the same as the original AOUT driver with the names changed, and the latching copied from the MBCV AOUT_Load2SR_Loop: banksel _aout_sr0 bcf AOUT_LC_LAT_DOUT, AOUT_LC_PIN_DOUT ; set DOUT depending on current MSB btfsc _aout_sr1+1, 7, BANKED bsf AOUT_LC_LAT_DOUT, AOUT_LC_PIN_DOUT rlcf _aout_sr0+0, F, BANKED ; start to shift the 16-bit value rlcf _aout_sr0+1, F, BANKED ; second step for the 16-bit shift bsf AOUT_LC_LAT_SCLK, AOUT_LC_PIN_SCLK ; rising clock edge rlcf _aout_sr1+0, F, BANKED ; third step for the 16-bit shift rlcf _aout_sr1+1, F, BANKED ; last step for the 16-bit shift bcf AOUT_LC_LAT_SCLK, AOUT_LC_PIN_SCLK ; falling clock edge banksel _loop_ctr decfsz _loop_ctr, F, BANKED ; loop 16 times ONLY 16 BIT FOR _LC bra AOUT_Load2SR_Loop ;; bsf AOUT_LAT_CS, AOUT_PIN_CS; deactivate chip select NOT NEEDED FOR AOUT_LC bsf AOUT_LC_LAT_RCLK, AOUT_LC_PIN_RCLK ; latch SID values COPIED FROM MBCV DRIVER bcf AOUT_LC_LAT_DOUT, AOUT_LC_PIN_DOUT ; clear out pin (standby) COPIED FROM MBCV DRIVER bcf AOUT_LC_LAT_RCLK, AOUT_LC_PIN_RCLK ; release latch COPIED FROM MBCV DRIVER __endasm; } It's basically the original AOUT driver from the toolbox, but with the new names for the pins, and the clocking/latching stolen from the MBCV AOUT_LC driver. You'll notice the difference is that the CS line is not clocked like it is in the original (at the beginning and end of the code, look for "NOT NEEDED FOR AOUT_LC"), but the RCLK line is.... I think that's what TK means ;)
  6. Yeh well so long as the wires are soldered to the correct pin, it seems the same ??? Ahh I see what TK means, it's the driving of the pins... Hang 5....
  7. Not sure how, but I missed this post. Yeh you're right, it pretty much is just renaming the define... from the ucapps page: As you can see, the pins you use can vary... Just pick whichever ones suit you best, I guess :)
  8. Nah they're not quite the same... #define CV_AOUT_LC_LAT_RCLK LATC ; The latch enable input Means that when you refer to the RCLK pin in code as "CV_AOUT_LC_LAT_RCLK", the precompiler will replace that with "LATC", Which is the latch register for port C on the PIC #define CV_AOUT_LC_TRIS_RCLK TRISC ; is connected to Port C.5 Same kind of thing, this refers to TRISC which is the tristate register for the port (makes it an In or Output) For example this code clears the register which enables the pins as outputs: CV_AOUT_LC_Init ;; enable pin drivers bcf CV_AOUT_LC_TRIS_RCLK, CV_AOUT_LC_PIN_RCLK bcf CV_AOUT_LC_TRIS_DOUT, CV_AOUT_LC_PIN_DOUT bcf CV_AOUT_LC_TRIS_SCLK, CV_AOUT_LC_PIN_SCLK And this one replaces the pin designation with a number: #define CV_AOUT_LC_PIN_RCLK 5 ; (CANNOT be shared with other outputs!) So basically all those defines are to use PORTC pin 5 as an output.... So: // common AOUT connections (MIDIbox CV pinning) #define AOUT_LAT_CS _LATC // The chip select pin CS# #define AOUT_TRIS_CS _TRISC // is connected to Port C.5 #define AOUT_PIN_CS 5 // (CANNOT be shared with other outputs!) // #define AOUT_LAT_DIN _LATC // The data input pin DIN #define AOUT_TRIS_DIN _TRISC // is connected to Port C.4 #define AOUT_PIN_DIN 4 // (can be shared with other outputs) // #define AOUT_LAT_SCLK _LATD // The shift clock input pin SCLK #define AOUT_TRIS_SCLK _TRISD // is connected to Port D.5 #define AOUT_PIN_SCLK 5 // (can be shared with other outputs) Means CS = C5 DIN = C4 SCLK = D5 and #define CV_AOUT_LC_LAT_RCLK LATC ; The latch enable input #define CV_AOUT_LC_TRIS_RCLK TRISC ; is connected to Port C.5 #define CV_AOUT_LC_PIN_RCLK 5 ; (CANNOT be shared with other outputs!) ; #define CV_AOUT_LC_LAT_DOUT LATC ; The data pin #define CV_AOUT_LC_TRIS_DOUT TRISC ; is connected to Port C.4 #define CV_AOUT_LC_PIN_DOUT 4 ; (can be shared with other outputs) ; #define CV_AOUT_LC_LAT_SCLK LATD ; The shift clock input pin SCLK #define CV_AOUT_LC_TRIS_SCLK TRISD ; is connected to Port D.5 #define CV_AOUT_LC_PIN_SCLK 5 ; (can be shared with other outputs) RCLK = C5 DOUT = C4 SCLK = D5 :)
  9. feel free to drop me an email :)
  10. There's always the option of running your gear through a UPS... generally a good idea anyway ;)
  11. 4x20's are around $40 Aussie dollars. Only $AU (I'm not a store or anything just a dude going shopping), but I'll take it via paypal, so the conversion to AUD is free... I've placed my order so let me know ASAP :)
  12. I'll be ordering 8 2x20's which I was quoted about AUD$30 each.. If I could get another two I might make a price break, so it might be less... If you take crystalfontz as an example, they're USD30 each, or USD20 each for 10 or more... So if I can find two others who need one, we might get a 2x20 PLED for AUD$20 :) In fact now that I think of it, if I do get a price break like that, it'd actually cost less for 10 than for 8, so I'm gonna go place a quote for 10 now...Anyone want in? Edit: Oh yeh, Tk advised against VFD's for time sensitive stuff because they're slow and could impact performance ....
  13. LOL funny post ;) Ok it might be easier to do a scan matrix then :( Darn! Or.... You could just ignore all values which don't match your increments of 1.2k.... For eg if the drawbar is on stop 2 (2k4) AND stop 3 (3k6), you'll get 800ohms resistance, which isn't a multiple of 1k2, so it gets ignored... etc etc. I've just fed all the values into MiscEl (a very cool calculator if you don't already have it) and it looks like it'll work. Now back to bed for me. I have the flu, and no amount of troubleshooting can fix that ;)
  14. >10k = OK <10k = You need AC's trick....
  15. Props man. Believe me, that hole in the ozone layer, which sits right over Australia, you can feel that in summer.....And our weather is changing drastically every year....Dodgy.
  16. Love the case mod! How'd you cut and join it so cleanly!?
  17. Yeh totally, I was so busy trying to get the MBCV aout_lc driver working, I never thought of that! Then again, I have never really looked at the aout modules before, and didn't realise how they worked.... At least we all just learned heaps about using ASM in the C wrapper :D How's this sound: add defines for the rclk pin: #define CV_AOUT_LC_LAT_RCLK LATC ; The latch enable input #define CV_AOUT_LC_TRIS_RCLK TRISC ; is connected to Port C.5 #define CV_AOUT_LC_PIN_RCLK 5 ; (CANNOT be shared with other outputs!) then change: movlw 32 ; init loop counter to movlw 16 ; init loop counter so it only does 16 bits replace bsf AOUT_LAT_CS, AOUT_PIN_CS; deactivate chip select with bsf CV_AOUT_LC_LAT_RCLK, CV_AOUT_LC_PIN_RCLK; RClock low (and also do that change in the Init function where the pin is cleared) Am I on the right track there?
  18. Already done ;) Unfortunately the display comes as part of a larger and somewhat pricey subassembly :(
  19. Do they fit on the tact switches OK? Some of them look split?
  20. The FSR's are used as a fast way to move around the bytes before loading them into the AOUT pins... Maybe it would be easier done in C, and then optimising later... I'll get to that ;) Here a quick example of how it works for a full aout module in the toolbox app: in map.c, the incoming midi events are mapped to an aout like this: /////////////////////////////////////////////////////////////////////////// // AOUT #2: forward CC#1 (Modwheel) of MIDI channel #1 aout_value[1] = CONV_7BIT_TO_12BIT(midi_cc_chn0[1]); When the aout is requested by the application to be updated, it calls the update like so: ///////////////////////////////////////////////////////////////////////////// // This function should be called from USER_Tick() to update the requested // AOUT pins ///////////////////////////////////////////////////////////////////////////// void AOUT_Update(void) { <--SNIP--> if( (aout_value[1] != last_aout_value[1]) || (aout_value[5] != last_aout_value[5]) ) { AOUT_Load2SR(aout_value[1] | (0x3000 | (1 << 14)), aout_value[5] | (0x3000 | (1 << 14))); As you can see, the above aout_value was passed to the AOUT_Load2SR function, which loads 2 of the shift registers of the aout module. Ignore the (0x3000 | (1 << 14) for now, that sets flags which are used elsewhere. My suggestion is an alternate implementation of Load2SR that would be more comfortable in C. Obviously it is important to follow some optimisations so that could take some consideration after this, these are just quick ideas...: The MIDIBox CV has a good example of loading the AOUT_LC's SR with a 16 bit value. In ASM, it takes each bit from CV_AOUT_LC_WRITE_BIT TMP1, 7 CV_AOUT_LC_WRITE_BIT TMP1, 6 CV_AOUT_LC_WRITE_BIT TMP1, 5 CV_AOUT_LC_WRITE_BIT TMP1, 4 CV_AOUT_LC_WRITE_BIT TMP1, 3 CV_AOUT_LC_WRITE_BIT TMP1, 2 CV_AOUT_LC_WRITE_BIT TMP1, 1 CV_AOUT_LC_WRITE_BIT TMP1, 0 CV_AOUT_LC_WRITE_BIT TMP2, 7 CV_AOUT_LC_WRITE_BIT TMP2, 6 CV_AOUT_LC_WRITE_BIT TMP2, 5 CV_AOUT_LC_WRITE_BIT TMP2, 4 CV_AOUT_LC_WRITE_BIT TMP2, 3 CV_AOUT_LC_WRITE_BIT TMP2, 2 CV_AOUT_LC_WRITE_BIT TMP2, 1 CV_AOUT_LC_WRITE_BIT TMP2, 0 This uses the macro below: CV_AOUT_LC_WRITE_BIT MACRO reg, bit bcf CV_AOUT_LC_LAT_DOUT, CV_AOUT_LC_PIN_DOUT ; set out pin depending on register content (reg.bit) btfsc reg, bit bsf CV_AOUT_LC_LAT_DOUT, CV_AOUT_LC_PIN_DOUT nop bsf CV_AOUT_LC_LAT_SCLK, CV_AOUT_LC_PIN_SCLK ; rising clock edge bcf CV_AOUT_LC_LAT_SCLK, CV_AOUT_LC_PIN_SCLK ; falling clock edge ENDM This clears the latch and pin, and then, if the bit which was passed to the macro is set, it sets the pin high, otherwise it leaves it low. Then, the clock is strobed. This macro's behaviour should be easily duplicated in C. The obvious solution is to setup some loops, but as you can see, TK has done manual 'unrolled' loops, to save on CPU, at the expense of code size. We should do the same... Remember the toolbox app will present the aout_value[] as a 12-bit variable because it's designed for the full AOUT module. What we would need to do is combine two of the values into a 16 bit value, or to be more true to the original, a pair of 8 bit values, with C functions that would replace the two functions seen in the other apps supporting the AOUT_LC: CV_AOUT_LC_LoadAOUTx_12_8 (Shouldn't that be CV_AOUT_LC_LoadAOUTx_12_4?) and CV_AOUT_LC_LoadAOUTx_8_8. Those two ASM functions take the two values (12+4 or 8+8) and put them in TMP1 and TMP2, so that they can be used by the above macro. We would be taking aout_value[1] and aout_value[5] (remember the top of this post? It was so long ago! heheh) which are both 12-bit values, and using them to set the value of a 16 bit variable (or 2 8-bit variables). I'm not sure what order the bytes need to go into the AOUT_LC module, but this is where that order should be set. Once we have our 16 bit variable (or 2 8-bit variables) then we just need to pass one bit at a time to a function like this...: void CV_AOUT_LC_WRITE_BIT(unsigned bit thisbit){ __asm bcf CV_AOUT_LC_LAT_DOUT, CV_AOUT_LC_PIN_DOUT ; set it low __endasm if thisbit > 0{ //Only do this if the bit is set __asm bsf CV_AOUT_LC_LAT_DOUT, CV_AOUT_LC_PIN_DOUT ;set it high __endasm }; once every bit of the 16 bit value has been passed to that function, we clock it in like this: //Now clock that bit. __asm nop bsf CV_AOUT_LC_LAT_SCLK, CV_AOUT_LC_PIN_SCLK ; rising clock edge bcf CV_AOUT_LC_LAT_SCLK, CV_AOUT_LC_PIN_SCLK ; falling clock edge __endasm } And then there's the rest of the stuff to be taken care of in a similar fashion... If all that crud will even work :-\ Now you guys know I'm still learning C, so please double check my syntax, but hopefully you'll get my idea. What do you think? Edit I already found one funny syntax error - "unsigned bit" LOL.. OK it's 1am, I'm outta here... I'll be interested to see what you say when I get up tomorrow morning! Edit2: Made that code make sense
  21. Don't worry too much about preinc and postinc, I don't know if we'll need them... I've got a kinda long post coming up before I got to bed and leave you guys to find out if I've totally screwed up or not ;) It should be about 5 minutes or so (which probably means 30 minutes knowing me)
  22. Moxi, many of the other compile errors are due to a need to refer to the variable with an _ before them, for eg _FSR0L, not FSR0L. This is because they've been defined in C. Interesting... The C Wrapper doesn't define FSRx, but just FSRxL and FSRxH. This means that we cant refer to FSR0, but FSR0_L and FSR0_H, the low and high bytes of the address. As AC mentioned before, they're a 12 bit value, this is implemented by FSRx_L being the lower 8 bytes, and FSRx_H being the upper 4 bytes of FSRx. Only the lower bytes of FSRx_H are used, the upper bytes are discarded. < FSR0 > X X X X121110 9 8 7 6 5 4 3 2 1 FSR0_H | FSR0_L 8 7 6 5 4 3 2 1 8 7 6 5 4 3 2 1 X X X X 0 0 0 0 0 0 0 0 0 0 0 0 As for the defines of AOUTx_LH, I think the MIDIBox CV's implentation (in app_defines.h) is the best point of reference. They could probably be defined in C, but I don't know if there's any point... Although I'm not sure how to load the FSR's now :-\ Any clues?? I'm thinking maybe going from this: lfsr FSR1, AOUT6_L ; loads AOUT6_[LH] and AOUT7_[LH] to this: lfsr _FSR1H, _AOUT6_L ; loads AOUT6_[LH] and AOUT7_[LH] And just using the high byte to refer to the register. I suspect it will load the following FSR1L also... I think that might be one for TK ;)
  23. I should add, that the value of AOUT0_L is loaded into FSR0 to point to a memory location... If you search for FSR in the datasheet it makes more sense than I do ;)
  24. AOUT0_L is a pointer to a memory location which is fixed... The value which changes, is not stored in AOUT0_L itself, but at the memory location which is specified by AOUT0_L... Did that make sense?
  25. That might make it a bit easier :) One thing about the resistive method that just occurred to me... The resistance of the buss itself will need to be taken into account... This might mean soldering the resistors onto each switch, rather than just the beginning of each buss. I'll leave that up to your multimeter, I doubt it will be much, so you probably can ignore it. Hah no I just changed it ;)
×
×
  • Create New...