You need to be able to address each magnet individually. Each magnet will need a register to hold the value relating to intensity of the magnet's field, and also some means of turning that value into current through the magent coils.
You could use something I would call binary controlled PWM.
thought A: for one channel, you could use series of pulses, average the voltage by low pass filter, and send it to PWM or just use the voltage created for controlling the current through the magnets. For example for 0.125*maxpower resolution, sending 0000 0001 would create 1/8 of maximal power, 0000 0011 1/4 and so on.
thought B: now you use a demultiplexer 1 of 64 and an enable signal. The pic would cycle through the 56 addreses and send also the enable signal when there is a 1 in on that position for the decoder. So sending one data block to each magnet would take 8*86=512 clock cycles. You would also need to amplify the singnal of the decoder by 56 to get the same voltage like in thought A.
And that´s what I worked out after coming form a pub
If you can use linear voltage to control the magnets (instead of PWM), you could use a little fleet of multi-channel DACs (I, personally, would choose the ones that interface to the PIC via I2C).
I looked into the I2C idea, and a quad DAC runs about $6, so for a prototype I don't care about the price, but for reproduction, I think it's overkill. Even at high QTY, the DACs would run over $40 for 14 of them.
How about analog multiplexing, using op-amps (LM324's) to sample and hold and using CD4067's, 16 chan demultiplexers to select and refresh them.
All you need send from the PIC is a count of 0 to n to address the 4067's, and a new analog voltage on each new count to sample.
You can then hold the level required for each magenet in memory, and just refesh the whole lot with a subroutine within the program.
After the op-amp, just use a simple emiter follower to drive each magenet.
It sounds complicated, but that's how I send 256 lighting channels from my lighting desk to the stage (down a ballanced mic cable).
Ah!!! before enyone says it... Yes it is faster and more reliable than DMX !!!
and has been running now for 9 years. every day....
4 x 4067's, 1 x 4028, some inverters, 16 x LM324's, 1 transistor per output and some cap's. will give you up to 64 channels..
Mmm... sounds like a lot of work, but when you think about it, If you are doing it on 1 PCB, it is all repeated. So after one channel is designed it is just copying.
If you can do it in surface mount, it would be quite compact..
If you need an idea for a schematic... let me know.