Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Ruby on May 30, 2013, 03:29:07 PM

Title: PIC Microcontroller
Post by: Ruby on May 30, 2013, 03:29:07 PM
Hi all. I wanted to control digital pot ( AD5206 ) via parallel port but you guys told me that is very hard and I will need microcontroller instead. So I have already ordered K150 programmer and pic from ebay. I got rf modules for 2-3 $ to use in the future. So Please correct me if get right idea how pic works. ( Please consider that I am very new in electronics. )
Parallel port has 8 pins low/high and these are digital ( 2 to 9 ) 1 byte.
PIC has a program inside which I will need to write. And only way to control the pic is changing the value of pins from low to high.
The thing is I still didn't get it how it controls the digital pot? Does it behave like a encoder something?
Thanks
Title: Re: PIC Microcontroller
Post by: waltr on May 30, 2013, 09:52:53 PM
That digital pot uses a serial SPI interface not parallel.
http://www.analog.com/static/imported-files/data_sheets/AD5204_5206.pdf (http://www.analog.com/static/imported-files/data_sheets/AD5204_5206.pdf)
Read and study this data sheet as all that needed to control them is there.

All PIC micro-controllers can interface with this digital pot with SPI.

To start learn how to use and program PICs see this tutorial:
http://www.gooligum.com.au/tutorials.html (http://www.gooligum.com.au/tutorials.html)

Download and study the data sheet for the PIC used in the lesson. Then download and install MPLAB 8.xx from Microchip's web site. This is the IDE and assembler needed to write code for the PIC. It also has a good Simulator that allows running & stepping code with needing any real hardware. This is great for learning and debugging code.
 
Title: Re: PIC Microcontroller
Post by: Ruby on May 31, 2013, 02:50:09 AM
Thanks for reply but still u didn't answer my questions. What did i write about parallel ports and pics are correct?
I read at least 5 times the datasheet but still I didn't understand  :-[; maybe because of my English....

About AD5206
CS==> Has to be high to select
SDI==> Terminal address ( 001 or 010 etc... )
CLK==> What does it do and what has to be?
CS==> Has to be low to finish

Am I right????
Title: Re: PIC Microcontroller
Post by: Graynomad on May 31, 2013, 06:24:48 AM
CS has to be LOW to select the AD5206.
CLK has to pulse for every bit you send on the SPI bus.

Have a look at figure 3 in the data sheet, that shows the expected wave form quite well.
Then read up on SPI, it is well documented.

You have to write a program that sends data to the AD5206, you can either use the inbuilt SPI port on the PIC or "bit bang" the protocol using some digital IO pins.

_____
Rob
Title: Re: PIC Microcontroller
Post by: Ruby on May 31, 2013, 06:52:26 AM
Hi Rob;
Thanks for reply. Can I use this schematic to control the pic via usb??
http://electronics-diy.com/USB_IO_Board.php (http://electronics-diy.com/USB_IO_Board.php)
or
http://wiki.pinguino.cc/index.php/PIC18F2550_Pinguino (http://wiki.pinguino.cc/index.php/PIC18F2550_Pinguino)

PS: Is it possible to wire rf transmitter to TX of the pic which is number 17 and I need to wire the receiver to RX which is pin 18 right?
Thanks.
Title: Re: PIC Microcontroller
Post by: Graynomad on May 31, 2013, 09:37:03 AM
What happened to interfacing with a digital pot?

I'm not familiar with those PIC circuits/boards but it seems they will allow you to program the chip and by extension "control" them.

Quote
Is it possible to wire rf transmitter to
What RF transmitter, there are 1000s of them. That will probably work IF the transmitter has an ASYNC serial interface like for example an XBEE.

Title: Re: PIC Microcontroller
Post by: Ruby on May 31, 2013, 11:51:24 AM
Sorry u r right. I went one step further. So what do u say about these schematics? Will they work?
Title: Re: PIC Microcontroller
Post by: Graynomad on June 04, 2013, 11:59:59 PM
See my last reply, that's the best I can say about them.

_____
Rob