Hi,
I am searching for info and examples for controlling a digital pot serially using shiftout. I am using the pic18f452, and I'm not sure which digital pot to use. Any suggestions/info would be greatly appreciated.
Thank you,
TonyA
Hi,
I am searching for info and examples for controlling a digital pot serially using shiftout. I am using the pic18f452, and I'm not sure which digital pot to use. Any suggestions/info would be greatly appreciated.
Thank you,
TonyA
those i already used in the past from Microchip
MCP42010, MCP42050,MCP42100, MCP41010,MCP41050,MCP4110.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Not where i am, but i could download the datasheet and try something somewhere today.
As i remind it wasn't too complicated. Maybe there's some example here already done. Do a search with the model i suggest, you may find something![]()
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I appreciate that very much. I will try a search here.
Thanks again,
Tony
O.K it's untested but it should work for any MCP4XXXX digital pot. Try it and post your results
Now connect PA0 too vcc, PB0 to GND and read the voltage on PW0 pin... is this working?Code:' ' Hardware configuration ' ====================== TRISC=0 ' ' Hardware connection ' =================== CS VAR PORTC.0 CLK VAR PORTC.1 SI VAR PORTC.2 ' ' Variables definition ' =================== Wiper var byte ' ' Constants definition ' ==================== MSBFIRST CON 1 WriteOnPot0 con %00010001 ' ' Software/Hardware initialisation ' ================================ cs = 1 ' disable MCP PAUSE 100 ' safe settle time Start: for wiper = 0 to 255 cs=0 ' enable shiftout si,clk, MSBFIRST,[WriteOnPot0, WIPER] ' Write to MCP cs = 1 ' Disable pause 10 next goto start
Last edited by mister_e; - 2nd June 2006 at 14:53.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi,
I appreciate that very much.
What is this constant doing : WriteOnPot0 con %00010001 ?
(I aplogize in advance if this is obvious, my brain is a little jumbled today).
I will be getting the digital chip in a few days and I will try this out and post results.
I'll be using an analog sensor read by the pic 18f452 using adcin. Then interpreting that analog reading for use in the "Wiper" variable. So as the analog sensor changes so will the digital pot.
Thank again,
TonyA
This constant is the CommandByte needed by the chip. Read datasheet section 5, and look the figure 5-2.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks