Jump to content

Clockbox BPM Display


Midnite
 Share

Recommended Posts

Hello Midibox world,

I'm currently building a clockbox and would like to encorperate three, 7 segment led digits to show bpm.

I've looked around and have tried a couple things but I'm pretty lost.

The dout works along with the din as the project works fine as is.

I realize some code will need to be added, but from where to where is the question.

I will continue to try, but any help on this would speed things up considerably.

Thanks,

M

Link to comment
Share on other sites

I didn't read all six pages of clockbox forum posts, but it looks like the current schematic uses a DOUTX1 for the eight LEDs. If you use a DOUTx4 instead, you'll have three extra groups of eight outputs..

Use each one for one 7 segment display, and you should have control of the display from your core.

Of course you'll set the resistors on those DOUT groups to whatever your display segments need.

From the code side, there is a 3 digit BPM display on the LCD. So you can either find the code that puts those together, OR you can reverse-engineer the three digits from the display routine like this:

The LCD is programmed with ASCII characters. the codes for Zero through Nine are actually 48 to 57 (decimal). SO if you grab the ASCII codes, then subtract 48, you'll have numbers zero to nine.

Finally, you'll need to "draw" how you want each number to look on the 7 seg display, and write a small subroutine to convert 0-9 into those shapes. Since 7 segments fits into a byte, it's pretty simple.

Finally, every time the BPM is updated, you'll use the above "stuff" to get the correct codes to send to the last three DOUT registers.

Yeah,I know. That's easy for ME to say. Really it's not too bad. A good chance to spruce up your programming chops.

Have Fun,

LyleHaze

Link to comment
Share on other sites

Wow. I have no idea how to properly program, so this might be a stretch.

I've built the appropriate connections for my 7 segment leds but still lack the code to make them useful.

I was thinking of somehow borrowing some code from the MB808 project because it already has a BPM display.

Any suggestions, such as copy and paste or some kind of version of that? Otherwise I'll just go with the clockbox as is.

Thanks,

-M

Link to comment
Share on other sites

Well they're wired according to  http://www.ucapps.de/midibox_seq/mbseq_v3_bpm_digits.pdf,  but can be moved around the doutx4 as needed (it's a plug). Right now dot thru g is connected to J3 and the common anode is connected to J4 at D2.

The source code is

=== BPM digits ===

;

; set to 1 or 2 to enable the 3 optional BPM digits

;    0: BPM digits disabled

;    1: digits with common cathode

;    2: digits with common anode

#define DEFAULT_BPM_DIGITS_ENABLED 0

;

; define the shift register to which the segments are connected (0=disabled)

#define DEFAULT_BPM_DIGITS_SEGMENTS 5

; define the shift register to which the common pins (cathodes or anodes) are connected (0=disabled)

#define DEFAULT_BPM_DIGITS_COMMON 6

It's located in the setup_808_mbseqv3_tk.asm.

I need this functionality but I understand much more is needed to make this work for me.

Also I'm using a 18f452 not the proper chip for seqv3.

-M

Link to comment
Share on other sites

Oh well.

I thought I'd get to help, but it looks like you already have it all!

ASSUMING that you are connected to the second DOUTX4 module as described in the print you showed me, then all you should need to do is set the three #defines to the way they are shown in that print.

Find these defines and change them to:

#define DEFAULT_BPM_DIGITS_ENABLED 2

#define DEFAULT_BPM_DIGITS_SEGMENTS 5

#define DEFAULT_BPM_DIGITS_COMMON 6

Then re-compile the application. That MIGHT be all you need to do!

note: I didn't realize that all this was already coded. It looks like it is.

Good for you!

LyleHaze

Link to comment
Share on other sites

It looks like the code in seq_leds.inc reads the #defines.

It looks like seq_bpm.inc has the code I described earlier.

I found these using the "search" feature of Windows.

From Linux, a "grep" would have been even faster.

It's all in there already, as far as I can tell.

Have Fun,

LyleHaze

Link to comment
Share on other sites

After copying seq_bpm.inc and seq_led.inc from mb808 stock into the include folder for clockbox and changing the bpm digits#defines then build I get nothing.

I also changed the dout shift register in the clockbox main.h to 4 to avoid problems, still nothing.

I'm still going at it, but am just as lost as ever.

-M  ???

Link to comment
Share on other sites

I found the files in midibox_seq_v3_4e\src

Is that the same project you are building?

If not, you'll have some coding to do..

Look in seq_leds.inc around line 636. this looks like the code for displaying the values stored in BPM_DIGIT_0 to _2..  a good start.. looking above it to see how often it's called..

Looking around line 223, it appears hat it's being called at the beginning of every DOUT service loop. You'll need to make similar arrangements. Make sure you save off and restore the PRODH and PRODL regs if multiplication is being done..

Over in the other file looks like the code to load various values into those three digits.

Modify your application to load the correct values into the three BPM digits whenever there is a tempo change.

It's time to get in there and muck about a bit. Have Fun!

LyleHaze

Link to comment
Share on other sites

Thanks again Lyle. Your input is very helpful. Now I just gotta find the time (and brain power)  :P to get this code thing down.

Unfortunately achitecture studio (CU) leaves little time these days for fun hobbies like this.

I'll do more reading at some point so I can get this project where I want it.

It'll be a while, but I'll post my progress with this to help out others in the same boat.

Thanks,

-M

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...