Interfacing the Pic16F877A with the MCP3201 12-Bit ADC.
Interfacing the Pic16F877A with the MCP3201 12-Bit ADC.
Hi
I intend on Interfacing the Pic16F877A with the MCP3201 12-Bit ADC using SPI. I was just wondering if anyone has done this in the past and have any routines for this. I know a bit of C programming, but I've never actually tried any sort of interface communication.
Ive most of the rest of the programme written in Flowcode V3 and its running fine.
Im kinda stuck at the moment on a project Im doing because of this and I could really use some help with it
Any input is appreciated and both data sheets are on Microchip.com if you need more info.
TIA
Muxer
I intend on Interfacing the Pic16F877A with the MCP3201 12-Bit ADC using SPI. I was just wondering if anyone has done this in the past and have any routines for this. I know a bit of C programming, but I've never actually tried any sort of interface communication.
Ive most of the rest of the programme written in Flowcode V3 and its running fine.
Im kinda stuck at the moment on a project Im doing because of this and I could really use some help with it
Any input is appreciated and both data sheets are on Microchip.com if you need more info.
TIA
Muxer
- 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:
Hello Muxer
Can you just use the Flowcode SPI component.
You will need a PICmicro with SPI hardware capability.
You will also need to select a output pin to use as the Chip Select Pin. This enables the ADC module.
You will then need to create a flowchart with the following hardware macro calls.
SPI_Init
Send CS Output High
Send CS Output Low //Enable ADC
SPI_GetChar //Collect MSB
SPI_GetChar //Collect LSB
Send CS Output High //Disable ADC
You may possibly need a SPI_PutChar 0x00 before collecting the MSB to clock through the analog conversion.
Without having the hardware here to test it is a little difficult to say that this will perform correctly. However it shouldn't be far off. With maybe a minor tweak here or there you should be up and running.
Can you just use the Flowcode SPI component.
You will need a PICmicro with SPI hardware capability.
You will also need to select a output pin to use as the Chip Select Pin. This enables the ADC module.
You will then need to create a flowchart with the following hardware macro calls.
SPI_Init
Send CS Output High
Send CS Output Low //Enable ADC
SPI_GetChar //Collect MSB
SPI_GetChar //Collect LSB
Send CS Output High //Disable ADC
You may possibly need a SPI_PutChar 0x00 before collecting the MSB to clock through the analog conversion.
Without having the hardware here to test it is a little difficult to say that this will perform correctly. However it shouldn't be far off. With maybe a minor tweak here or there you should be up and running.
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:
Referring to page 15 of the datasheet.
It just takes two SPI_GetChar operations to perform a capture and clock out of the data. If you construct the program that i mentioned before then you should get the data. It may then take a bit of formatting. eg shifting one bit to the right. this can be done with a calculation icon and >> 1 to shift one place to the right.
It just takes two SPI_GetChar operations to perform a capture and clock out of the data. If you construct the program that i mentioned before then you should get the data. It may then take a bit of formatting. eg shifting one bit to the right. this can be done with a calculation icon and >> 1 to shift one place to the right.
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
- AbhijitR
- Posts: 300
- Joined: Fri Nov 07, 2014 12:48 pm
- Location: Pune, India
- Has thanked: 283 times
- Been thanked: 80 times
Re:
Hello! Ben
Kindly excuse to dig such an old post but honestly i did not find or you could say understand any relevant top on MCP3201 other then this post.
Thank you.
Abhi
Kindly excuse to dig such an old post but honestly i did not find or you could say understand any relevant top on MCP3201 other then this post.
May i request you or anyone to prompt me how can i use MCP3201, as i do not find any ADC component (spoon-feeding ), no doubt it is very easy to use a 12bit ADC chip which is readily available but i want to explore another 4-20mA chip which has got MCP3201 onboard.
Thank you.
Abhi
-
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
Re: Interfacing the Pic16F877A with the MCP3201 12-Bit ADC.
Hi Abhi
Steve
can you expand on what you are looking for ?
Steve
Success always occurs in private and failure in full view.
- AbhijitR
- Posts: 300
- Joined: Fri Nov 07, 2014 12:48 pm
- Location: Pune, India
- Has thanked: 283 times
- Been thanked: 80 times
Re: Interfacing the Pic16F877A with the MCP3201 12-Bit ADC.
Hello! Steve
Thanks for your reply.
Yes actually i received one small gadget recently, it is in below link for your reference, this gadget has INA196 to sense the 4-20mA current and also onboard ADC MCP3201, this ADC communicates on SPI, i have copy-paste the description as it is for your knowledge.
I was wondering if i could use a readymade component/macro like other available ADC (AD7680), unfortunately i do not understand what Ben mentioned in the other post to Muxer about using "SPI Component"
I hope there is some way to read the MCP3201.
Thank you again.
Abhi
Thanks for your reply.
Yes actually i received one small gadget recently, it is in below link for your reference, this gadget has INA196 to sense the 4-20mA current and also onboard ADC MCP3201, this ADC communicates on SPI, i have copy-paste the description as it is for your knowledge.
I was wondering if i could use a readymade component/macro like other available ADC (AD7680), unfortunately i do not understand what Ben mentioned in the other post to Muxer about using "SPI Component"
https://www.mikroe.com/4-20ma-r-click4-20mA R Click is an add-on board in mikroBUS form factor which serves as a receiver in a 4-20mA current loop standard. It features INA196 current shunt monitor, MCP3201 12-bit ADC as well as TPS61041 DC/DC boost converter. It receives output current (4-20mA) from transmitter and converts it into a voltage (0.4-2V). This voltage is converted into a 12-bit data signal in the MCP3201 A/D converter and sent via mikroBUS™ SPI lines. Together with 4-20mA T Click™ this board forms a complete 4-to-20mA current loop standard. It is designed to use either 3.3V or 5V power supply.
I hope there is some way to read the MCP3201.
Thank you again.
Abhi
-
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
Re: Interfacing the Pic16F877A with the MCP3201 12-Bit ADC.
Hi Abhi
the MCP3201 is an analogue to digital convertor that measurer's DC Voltages.
Are you looking to read the 4 - 20 mA current ? in this case you will need to convert the current to a voltage first.
you have asked this question in Flowcode V2 & V3 forums when you are active in the V8 forums is this a V2, V3 related question?
some more information on current loops and various measuring techniques can be found here :
https://www.matrixtsl.com/mmforums/view ... =7&t=18048
Steve
the MCP3201 is an analogue to digital convertor that measurer's DC Voltages.
Are you looking to read the 4 - 20 mA current ? in this case you will need to convert the current to a voltage first.
you have asked this question in Flowcode V2 & V3 forums when you are active in the V8 forums is this a V2, V3 related question?
some more information on current loops and various measuring techniques can be found here :
https://www.matrixtsl.com/mmforums/view ... =7&t=18048
Steve
Success always occurs in private and failure in full view.
- AbhijitR
- Posts: 300
- Joined: Fri Nov 07, 2014 12:48 pm
- Location: Pune, India
- Has thanked: 283 times
- Been thanked: 80 times
Re: Interfacing the Pic16F877A with the MCP3201 12-Bit ADC.
Hello! Steve
good morning
My concern is, is it possible to read the ADC from MCP3201 same like the existing component in FC8 AD7680, kindly excuse for posting on wrong version forum though i am a user of V8.
Thanks for the help topic.
Abhi
good morning
Yes absolutely, MCP3201 is a ADC chip which will measure the output voltage from INA196.
Yes you got me right i need to read 4-20mA current from a pressure transmitter or any sensor which outputs 4-20mA signal, for that purpose INA196 do the work of sensing the current and it outputs voltage 0.4V to 2V for corresponding 4-20mA, in this particular gadget which i posted earlier, this is then feed to MCP3201.
Kindly excuse me if i have posted or continued on a wrong version, is that okay if i start a new topic in V8 forum? kindly advise.
My concern is, is it possible to read the ADC from MCP3201 same like the existing component in FC8 AD7680, kindly excuse for posting on wrong version forum though i am a user of V8.
Thanks for the help topic.
Abhi
-
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
Re: Interfacing the Pic16F877A with the MCP3201 12-Bit ADC.
Hi Abhi
Steve
You will get better and more current advise in the V8 Forums
Steve
Success always occurs in private and failure in full view.