BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 1:06 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: atom pro ic2 to atom nano
PostPosted: Sat Jul 31, 2010 12:21 pm 
Offline
New User

Joined: Sat Jul 31, 2010 11:17 am
Posts: 3
Hello:
I am using an atom pro 40 in a custom application that uses a lot of I/O and I saw the atom nano 28 as a good, low cost solution to add the additional I/O and A/D functions I need to complete my project. I used Software serial buy slowed down my overall process. My hardware serials are in use. I am tiring to use i2c, but I find that I need a little help. The manual states that the atom is always the master. Hardware manual suggest that master/slave orientation can be set in the nano. has anyone got any ideas.


Top
 Profile  
 
 Post subject: Re: atom pro ic2 to atom nano
PostPosted: Sat Jul 31, 2010 8:37 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Studio BASIC is designed to make any Atom product an I2C master. If you know PIC assembly coding, you can make them work as an I2C slave.
There may be a simpler solution. The Nano's fixed 8 MHz clock means serial rates cannot exceed 38400 baud, IIRC. If you use the Atom intreperter IC, you have a part using a 20 MHz clock and it's the same PIC as used in the 28-pin and 40-pin Nano chip. These will run up to (and beyond?) 57600 Baud. These use the same commands as the Nano, so with minor differences you can use the same code you have now. The cost is $20 per part as compared to the Nano's $8, $10 and $11. And you have to add a 20 MHz resonator or crystal/caps to the circuit. But if you are using the 28 or 40 pin Nano, these other chips are damn near drop-in replacements.
Here is a link to the Atom 28-pin chip for comparison:
http://www.basicmicro.com/Basic-ATOM-Chip--28-DIP_p_143.html
'Luck with your project.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: atom pro ic2 to atom nano
PostPosted: Sun Aug 01, 2010 12:30 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
You don't have to use PIC asm code to use the hardware I2C. All the registers can be accessed in basic. To use the hardware i2c port you will have to enable the port as documented in the PICmicro datasheet and set it up to be a slave device. This is not a simple task by any means.

Note that the I2C commands DO NOT use the hardware I2C port. The I2C commands are strictly bit-banged. They use no special hardware features.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: atom pro ic2 to atom nano
PostPosted: Mon Aug 02, 2010 12:32 am 
Offline
Citizen

Joined: Sun Aug 01, 2010 11:46 pm
Posts: 6
Hi to all of you.

I've seen that sintax for I2C command for BASIC MICRO STUDIO has changed. I'm using 1.0.0.32 and a BasicAtomPro28. All is good when interfacing devices as SFR08.

But when I try to read on a device like MD25 (the popular double motor driver) I'm not able to obtain valid data.

I think to have tried all the possible combination of instructions but no success till now.

The more logical sequence seems to me the following

i2cout SDA, SCL, MotorR, [bReg]
i2cin SDA, SCL, MotorR, [bVal]

as usual:

SDA con P6 ;Data
SCL con P7 ;Clock
MotorR con 0xB1 ;Read Register of MD25
bReg var byte ;Register to read
bVal var byte ; value to collect

All function to write to MD25 are successful so I can move motors
If I use a different way to communicate (PC to MD25 via I2C adapter) I can read all quitely

May someone help me?


Top
 Profile  
 
 Post subject: Re: atom pro ic2 to atom nano
PostPosted: Mon Aug 02, 2010 12:36 am 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Please start a new post in this forum and show us your code in full, if there is more.
kenjj

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO