Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 12:00 25 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Digital potentiometer?

     Page 1 of 2    
Author Message
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 01:08pm 04 Apr 2020
Copy link to clipboard 
Print this post

Shamelessly looking for a short cut, here.

Any recommendations/code out there?

Cheers,

Craig
 
SimpleSafeName

Senior Member

Joined: 28/07/2019
Location: United States
Posts: 286
Posted: 01:33pm 04 Apr 2020
Copy link to clipboard 
Print this post

How about?

PRINT "Hello World"

:)
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 705
Posted: 01:47pm 04 Apr 2020
Copy link to clipboard 
Print this post

I've had sucess with some much like these ...

look here
Edited 2020-04-04 23:51 by hitsware2
my site
 
SimpleSafeName

Senior Member

Joined: 28/07/2019
Location: United States
Posts: 286
Posted: 01:53pm 04 Apr 2020
Copy link to clipboard 
Print this post

My apologies, I didn't read the title and I thought that you were looking for code ideas. LOL!
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 03:58pm 04 Apr 2020
Copy link to clipboard 
Print this post

  SimpleSafeName said  My apologies, I didn't read the title and I thought that you were looking for code ideas. LOL!


No, that was funny  

  hitsware2 said  I've had sucess with some much like these ...

look here


Ah, many thanks  
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 425
Posted: 05:20pm 04 Apr 2020
Copy link to clipboard 
Print this post

hi tinine

I give you an example of test prog for pot chip 4131 in SPI mode


Pin(16)=1:SetPin 16,dout  'for CS
valpot=&h1  'value to output

Do
 Pin(16)=0  'active cs
 SPI open 5000000,3,8
 junk=SPI(0)
 byte1=SPI(valpot)
 Pin(16)=1
 SPI close
 Pause 1000
 valpot=valpot+1
 if valpot=64 then valpot=1
Loop

 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 1985
Posted: 06:37pm 04 Apr 2020
Copy link to clipboard 
Print this post

Thanks for that code Goc

Strange how things come up when you need them... I was also playing with digital pots and had been looking at the MCP4131...
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 522
Posted: 08:23pm 04 Apr 2020
Copy link to clipboard 
Print this post

There are a lot now days have a look at Analog Devices

Funny in unpacking I found the demo playback unit today. Studio boards and code
where abouts to be discovered.  

Years ago I used Xcore X9103 with 8748 in a message playback unit.
It was sold for "message on hold telephone", in "store advertising shelf"
and a rental truck "vocal guide to shifting"

Had to make a studio board for a 286 motherboard with 2meg add on card as "ram Disk"
the HD's at the time wasn't fast enough. and the noise from the power supply was a
major problem to over come. Coding was Borland Pascal with a lot inline assembly.

Hope you don't mine going down memory lane with me.



The keypad was printed with my $240 radioshack printer "My mortgage was $105"
layout/etching in the kitchen. Very Fun days.









When I find the studio card I'll post few pic's. Hand wired.

The Xcore series was the only D-pot I could find at the time that used U/D count
pins it was easy to code for in 8748 asm.

Today with MMBasic and the mites this would be a maybe few nights of coding and
not the 18 months of programing/hardware trouble shooting on the 286 under MSDOS.

The 8748 was not bad to program for.

I'm Still having FUN doing this stuff. MMBasic has made it even more so !!!
Thanks Geoff, Peter Mather, Robert Rozee, Serge Vakulenko, Jim Tassy and
ALL the BACKSHEDERS that make this so ENJOYABLE and all the help given.

BE SAFE ALL
 Quazee137
Edited 2020-04-05 06:32 by Quazee137
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 09:38pm 04 Apr 2020
Copy link to clipboard 
Print this post

  CaptainBoing said  Thanks for that code Goc

Strange how things come up when you need them... I was also playing with digital pots and had been looking at the MCP4131...


Yeah many thanks Goc  

Holy moly, 88 page data sheet!?!?!?!  
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 1985
Posted: 09:10am 05 Apr 2020
Copy link to clipboard 
Print this post

not at all Quazee... perhaps we should ask Glenn to make a specific forum for random "Memory lane... Stuff we made" posts. Back in 1995 I was working on a call router for least cost routing automatically... found the first PCB of the prototype the other day, while clearing out some junk.
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1326
Posted: 11:56am 05 Apr 2020
Copy link to clipboard 
Print this post

Craig, Dan Amos wrote up an article in Silicon Chip's Circuit Notebook (June 2016 p86) using a Micromite BackPack, an MCP4131 digital pot and an AD9833 DDS sig gen chip. The MMBasic code for that which uses SPI to the 4131, is available from Silicon Chip.

Greg
 
mikeb

Senior Member

Joined: 10/04/2016
Location: Australia
Posts: 173
Posted: 09:51am 10 Apr 2020
Copy link to clipboard 
Print this post

Eproms. Remember those ? Baking them under UV, for 15 mins to reprogram.
And greencaps. Very nostalgic.
I remember a colleague putting the first Motorola 68HC microcontroller he ever played with in the socket backwards.  AUD $95.00 back in 1985.
There are 10 kinds of people in the world.
Those that understand binary and those that don't.
 
Lightrock
Newbie

Joined: 19/05/2014
Location: Australia
Posts: 26
Posted: 10:57am 10 Apr 2020
Copy link to clipboard 
Print this post

Geoff Graham has an article on a DDS Signal Generator on his web site which uses a Microchip MCP41010 digital potentiometer for level control. Geoff's article was in Silicon Chip April 2017. Code is also available from both sources
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 05:46pm 10 Apr 2020
Copy link to clipboard 
Print this post

  Lightrock said  Geoff Graham has an article on a DDS Signal Generator on his web site which uses a Microchip MCP41010 digital potentiometer for level control. Geoff's article was in Silicon Chip April 2017. Code is also available from both sources


Many Thanks!
Interesting to learn that above 211, it becomes distorted.


' sets the digital potentiometer (0-255)
' derived from an example written by Peter Mather (matherp on the Back Shed forum)
' note that when running on 3.3V the maximum undistorted level is 211
Sub SetLevel
 Local Integer x = (Level/100) * 211
 SPI Open 1000000, 2, 16
 Pin(CS) = 0
 SPI write 1, x Or &H1100
 Pin(CS) = 1
 SPI Close
End Sub


Cheers!

Craig
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 425
Posted: 10:55pm 10 Apr 2020
Copy link to clipboard 
Print this post

Hi tinine

I found another application with the MCP4131, it is an assembly allowing to manage the pulse width of a PWM. It is based on a 555 chip drived by the MCP

http://tibuworks.blogspot.com/2013/05/pwm-sincrono-synchronous-pwm.html




for using mcp4131 with an mx170. you must avoid the 28pin version, because it does not work properly, however with the 44pin version it is correct. I put here the last version that I tested with explorer64 (and validated with an arduino)



const pincs=60  'chipselect mcp4131
const pinrel=16  'I have led on this pin
const pinvl=30   'pin for ana read value
dim i as integer
dim valpot as integer
dim valin as float

setpin pinrel,DOUT
SetPin pincs,dout
setpin pinvl, ain

Pin(pincs)=1
Pin(pinrel)=1
valpot=&h1  'value to output

SetTick 500, task1,1    ' tache de base a faire toutes les 10ms  utile pour eteindre led de signalisation
do
Pin(pincs)=0  'active cs
SPI open 10000000,0,16
junk=SPI(0)
spi write 1,valpot
Pin(pincs)=1
SPI close
valpot=valpot+1
if valpot=>256 then valpot=1
pause(50)
  valin=pin(pinvl)
 print "pot=";str$(valpot);"   lue:";str$(valin)
loop


sub task1()
pin(pinrel)=(pin(pinrel) xor 1)
end sub

 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 12:04am 11 Apr 2020
Copy link to clipboard 
Print this post

@goc30

  Quote  
for using mcp4131 with an mx170. you must avoid the 28pin version, because it does not work properly, however with the 44pin version it is correct.


Is there a known problem with the SPI on the 28 pinner? It's this device that I am intending to use.

Regards,

Craig
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 425
Posted: 12:36am 11 Apr 2020
Copy link to clipboard 
Print this post

  Tinine said  @goc30


Is there a known problem with the SPI on the 28 pinner? It's this device that I am intending to use.

Regards,

Craig


I do not know where the problem comes from, but I did not search in detail. I have a few tracks, either add a pullup on the SDI / SDO line (see picture), or there is a problem with pin3 (which is also used as vref-). I have a little time right now, since we're locked up, so I'm going to study the matter


 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 01:07am 11 Apr 2020
Copy link to clipboard 
Print this post

I have used MCP4151 with 28 pinner with no issues. Only MCU SDO is connected to the SDI/SDO pin and MCU SDI is not connected. Seems to work OK.
Latest F4 Latest H7
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 705
Posted: 01:32am 11 Apr 2020
Copy link to clipboard 
Print this post

I have only used the 28 pin
and remember no problems .
my site
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 425
Posted: 01:47am 11 Apr 2020
Copy link to clipboard 
Print this post

Hi all
Have you also use analog pin in sme time?? (to read mcp value)
 
     Page 1 of 2    
Print this page
© JAQ Software 2024