MCP4161 - Digital Pot
Moderator: Benj
-
- Posts: 96
- Joined: Fri Jul 15, 2016 10:51 am
- Has thanked: 24 times
- Been thanked: 5 times
- Contact:
MCP4161 - Digital Pot
Hi all, can anybody help with a new componente for mcp4161 digital pot?
I appreciate
Thanks Rod
I appreciate
Thanks Rod
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: MCP4161 - Digital Pot
Hi Rod,
Yes this should be fairly easy. I'll have a look for you.
Yes this should be fairly easy. I'll have a look for you.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: MCP4161 - Digital Pot
It should now be available via the update system, let me know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 96
- Joined: Fri Jul 15, 2016 10:51 am
- Has thanked: 24 times
- Been thanked: 5 times
- Contact:
Re: MCP4161 - Digital Pot
Thanks, Benj. I´ll run tests and let you know. Ill use with the lcd_mini click.
Thanks
Rod
Thanks
Rod
-
- Posts: 96
- Joined: Fri Jul 15, 2016 10:51 am
- Has thanked: 24 times
- Been thanked: 5 times
- Contact:
Re: MCP4161 - Digital Pot
Benj thanks for the update of the mcp4161. I have a doubt concerning the lcd-mini click. The click has a digpot, a mcp23S17 and a lcd on a BL-0106. My question is, Looking at the way they are connected by using DSPic BL-0032, they only share one port. Iam using in this case PortD(0-7). How can I use two(chip select) from spi comm by using this board(BL0032)?
It is pretty clear to me that when I use lcd-mini click on mikroe board, its board shares different pins from other ports, so I can use right out of the box. But when I use the BL0032 it shares only one port and it is dificult for me to visualize how to share other pins if I dont have access to other ports.
Correct me if iam wrong, but I ve just bought BL-117 and BL0161 so I can have access to the other pins and be able to drive the click.
Maybe it is easy to show you with a Picture attached.
Thanks for any thoughts
Rod
It is pretty clear to me that when I use lcd-mini click on mikroe board, its board shares different pins from other ports, so I can use right out of the box. But when I use the BL0032 it shares only one port and it is dificult for me to visualize how to share other pins if I dont have access to other ports.
Correct me if iam wrong, but I ve just bought BL-117 and BL0161 so I can have access to the other pins and be able to drive the click.
Maybe it is easy to show you with a Picture attached.
Thanks for any thoughts
Rod
- Attachments
-
- Mikrobus_clicks.jpg (96.54 KiB) Viewed 7452 times
-
- LDD_Mini_Click.jpg (97.25 KiB) Viewed 7452 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: MCP4161 - Digital Pot
Hi,
If you have a look at the circuit diagram for BL0106 the SPI connections are directly compatible with the MCP23S17 port expander,
with chip select on port pin 2.
The MCP4161 digital potentiometer chip select is on the Click pin 1 which connects with the BL0106 "ANA" connector,
but this is not directly accessible on the port.
So I suggest that you connect a wire (underside of the BL0106, or top side of the click board) from the click pin 1 to another unused click pin such as pin 14,
this will then make the chip select for the MCP4161 available on the port pin 1
Hope that helps
Leigh
If you have a look at the circuit diagram for BL0106 the SPI connections are directly compatible with the MCP23S17 port expander,
with chip select on port pin 2.
The MCP4161 digital potentiometer chip select is on the Click pin 1 which connects with the BL0106 "ANA" connector,
but this is not directly accessible on the port.
So I suggest that you connect a wire (underside of the BL0106, or top side of the click board) from the click pin 1 to another unused click pin such as pin 14,
this will then make the chip select for the MCP4161 available on the port pin 1
Hope that helps
Leigh
-
- Posts: 96
- Joined: Fri Jul 15, 2016 10:51 am
- Has thanked: 24 times
- Been thanked: 5 times
- Contact:
Re: MCP4161 - Digital Pot
Hi leighM, thanks for responding, Ive done the connections sligtly diferente. I used another BL106 and connected in to rx and you proposed on last post using PortE.
My question now is related to the programming. In the hello world available provided by mikroe, I see the usage of a library for SPI_LCD because the specification of LCD is a LMB162XFW is a 2x16 LCD display with a deep blue display color, and light yellow green display data. The interface is in SPI. I couldnt find this componente available in our display source(Flowcode). Is there anybody out there kind enough to do this component for me please?
Iam stuck on this coding and I really would like to make this work.
Thanks for the support
I appreciate
Rod
My question now is related to the programming. In the hello world available provided by mikroe, I see the usage of a library for SPI_LCD because the specification of LCD is a LMB162XFW is a 2x16 LCD display with a deep blue display color, and light yellow green display data. The interface is in SPI. I couldnt find this componente available in our display source(Flowcode). Is there anybody out there kind enough to do this component for me please?
Iam stuck on this coding and I really would like to make this work.
Thanks for the support
I appreciate
Rod
-
- Posts: 96
- Joined: Fri Jul 15, 2016 10:51 am
- Has thanked: 24 times
- Been thanked: 5 times
- Contact:
Re: MCP4161 - Digital Pot
Hi all,
I openned a ticked to mikroe related to lcd-mini if it is a spi interface as it is written on the specification of the website. Analysing the connection of the lcd to expander, it looks like it is a regular lcd using the portb of the mcp23s17. While we wait for mikroe's answer, i was thinking about the connection of the lcd componente and its coding that i should consider on the programming. It is hard to visualize how to send commands to write a simple command of printing a string to lcd, considering that I dont know how to connect on software to the portB of the expander. Does anybody have a hint for this issue?
Thanks
Rod
I openned a ticked to mikroe related to lcd-mini if it is a spi interface as it is written on the specification of the website. Analysing the connection of the lcd to expander, it looks like it is a regular lcd using the portb of the mcp23s17. While we wait for mikroe's answer, i was thinking about the connection of the lcd componente and its coding that i should consider on the programming. It is hard to visualize how to send commands to write a simple command of printing a string to lcd, considering that I dont know how to connect on software to the portB of the expander. Does anybody have a hint for this issue?
Thanks
Rod
- Attachments
-
- LCD_Mini_Click_Part2.fcfx
- (11.65 KiB) Downloaded 236 times
-
- Posts: 96
- Joined: Fri Jul 15, 2016 10:51 am
- Has thanked: 24 times
- Been thanked: 5 times
- Contact:
Re: MCP4161 - Digital Pot
Hello all,
Well, for the last week Ive been trying to work on this program and I find it really hard. After trying many ways of figuring out how to interface the lcd with the components(MCP4161, MCP23S17 and pwm), and none of them worked out, Ive had the idea of replicating the xc8 hello world from code configurator into flowcode. Well I can tell you that is not easy at all. It is hard to combine the graphical componentes, coding at the same time and reverse engineering between C and flowchart. Ive had some results (good) but no writing on the lcd.
I attached both of the programs(XC8 and flowcode).
If anybody could give a hint if iam on the right track, that would be great.
Thanks a million
Rod
Well, for the last week Ive been trying to work on this program and I find it really hard. After trying many ways of figuring out how to interface the lcd with the components(MCP4161, MCP23S17 and pwm), and none of them worked out, Ive had the idea of replicating the xc8 hello world from code configurator into flowcode. Well I can tell you that is not easy at all. It is hard to combine the graphical componentes, coding at the same time and reverse engineering between C and flowchart. Ive had some results (good) but no writing on the lcd.
I attached both of the programs(XC8 and flowcode).
If anybody could give a hint if iam on the right track, that would be great.
Thanks a million
Rod
- Attachments
-
- LCD_Mini_Mikroe.X.7z
- (108.77 KiB) Downloaded 221 times
-
- LCD_Mini_Click_Part4.fcfx
- (36.37 KiB) Downloaded 223 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: MCP4161 - Digital Pot
Hi Rod,
We have a plan for the future to be able to drive I/O expander pins as if they were micro pins and hence components will be able to connect to these virtualised pins. Unfortunately we cannot do this currently and so it becomes fairly tricky.
Do you have access to an Arduino library that will work with the board. Maybe we can turn this into a component for you? I do have a similar component for an alphanumeric LCD behind a I2C I/O expander. Maybe we can do the same thing for the SPI expander?
We have a plan for the future to be able to drive I/O expander pins as if they were micro pins and hence components will be able to connect to these virtualised pins. Unfortunately we cannot do this currently and so it becomes fairly tricky.
Do you have access to an Arduino library that will work with the board. Maybe we can turn this into a component for you? I do have a similar component for an alphanumeric LCD behind a I2C I/O expander. Maybe we can do the same thing for the SPI expander?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 96
- Joined: Fri Jul 15, 2016 10:51 am
- Has thanked: 24 times
- Been thanked: 5 times
- Contact:
Re: MCP4161 - Digital Pot
Hi Benj, thanks for answering. I do not have a library for arduino, but instead I do have a written and solved application that worked for a pic18F8722 and PICDEM PIC18 Explorer and It connects to its LCM-S01602 DTR/m display via the MCP23S17 port expander. I found this example on mcu website and I found it interesting and iam working on it to see if I can do the same for flowcode. Things that i have to consider while designing:
Inclusion of the mcp4161 (Digital pot)
Inclusion of LCD-Display LMB162XFW which has a different initialisation time than the models PICDEM PIC18 EXPLORER and HD44780
Here is the code and believe that if we can somehow pipe commands through the SPI expander channel setup, it migh work.
The idea of having a spi lcd component is great, it might work, and that is what i was trying to somehow do.
Thanks again Benj
Inclusion of the mcp4161 (Digital pot)
Inclusion of LCD-Display LMB162XFW which has a different initialisation time than the models PICDEM PIC18 EXPLORER and HD44780
Here is the code and believe that if we can somehow pipe commands through the SPI expander channel setup, it migh work.
The idea of having a spi lcd component is great, it might work, and that is what i was trying to somehow do.
Thanks again Benj
Code: Select all
// Port Expander module connections
sbit SPExpanderRST at RF6_bit;
sbit SPExpanderCS at RA2_bit;
sbit SPExpanderRST_Direction at TRISF6_bit;
sbit SPExpanderCS_Direction at TRISA2_bit;
// End Port Expander module connections
sbit LCD_RST at RF6_bit;
sbit LCD_CS at RA2_bit;
sbit LCD_RST_TRIS at TRISF6_bit;
sbit LCD_CS_TRIS at TRISA2_bit;
sbit LCD_SCK_TRIS at TRISC3_bit;
sbit LCD_SDO_TRIS at TRISC5_bit;
//extern void Delay(void);
//extern void SDelay(void);
//*****************************************************************
// Write to MCP923S17 Port A
//*****************************************************************
void WritePortA(char b)
{
Expander_Write_PortA(0, b);
}
//*****************************************************************
// Write to MCP923S17 Port B
//*****************************************************************
void WritePortB(char b)
{
Expander_Write_PortB(0, b);
}
//*****************************************************************
// Write the data to the display
//*****************************************************************
void d_write(char b)
{
WritePortA(0x80);
Delay_ms(10);
WritePortB(b);
Nop();
Nop();
Nop();
Nop();
WritePortA(0xC0);
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
WritePortA(0x00);
//TXREG = b; //carriage return
//while(!LCD_TXSTA_TRMT); //wait for data TX
//LCD_TXSTA_TRMT = 0;
}
//*****************************************************************
// Send a instruction to the display
//*****************************************************************
void i_write(char b)
{
WritePortA(0x00);
Delay_ms(10);
WritePortB(b);
Nop();
Nop();
Nop();
Nop();
WritePortA(0x40);
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
WritePortA(0x00);
}
//*****************************************************************
// Write to line 1 of the display
//*****************************************************************
void LCDLine_1(void)
{
i_write(0x80);
}
//*****************************************************************
// Write to line 1 of the display
//*****************************************************************
void LCDLine_2(void)
{
i_write(0xC0);
}
//*****************************************************************
// To clear the display
//*****************************************************************
void LCDClear(void)
{
i_write(0x01);
}
//******************************************************************
// Function to write to the PORT
//******************************************************************
void InitWrite(char b)
{
WritePortA(0);
WritePortB(b);
Nop();
Nop();
Nop();
WritePortA(0x40);
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
WritePortA(0);
}
//******************************************************************
// LCD Initialization function
//******************************************************************
void LCDInit(void)
{
LCD_CS_TRIS = 0;
LCD_CS = 1;
Delay_ms(10);
Delay_ms(10);
Delay_ms(10);
LCD_RST_TRIS = 0;
LCD_RST = 0;
Delay_ms(10);
LCD_RST = 1;
SPI1_Init();
Expander_Init(0);
Expander_Set_DirectionPortA(0,0x00); // Set Expander's PORTA to be output
Expander_Set_DirectionPortB(0,0x00); // Set Expander's PORTB to be output
WritePortA(0);
Delay_ms(10);
InitWrite(0x3C); //0011NFxx
Delay_ms(10);
InitWrite(0x0C); //Display Off
Delay_ms(10);
InitWrite(0x01); //Display Clear
Delay_ms(10);
InitWrite(0x06); //Entry mode
}
void main(void)
{
// Initialize the LCD display.
LCDInit();
// Switch ti LCD line 1 ( sends a command to the LCD to tell it ).
LCDLine_1();
// Write the data one char at a time.
d_write('T');
d_write('H');
d_write('A');
d_write('N');
d_write('K');
d_write('S');
LCDLine_2();
d_write('B');
d_write('I');
d_write('G');
d_write(' ');
d_write('D');
d_write('O');
d_write('G');
while(1);
}
-
- Posts: 96
- Joined: Fri Jul 15, 2016 10:51 am
- Has thanked: 24 times
- Been thanked: 5 times
- Contact:
Re: MCP4161 - Digital Pot
Hi benj, i found the library for arduino using the lcd mini click. I Hope it helps creating the component.
Here is the link:
https://github.com/Electronza/MIKROE_LCDmini
Thanks a lot
Rod
Here is the link:
https://github.com/Electronza/MIKROE_LCDmini
Thanks a lot
Rod