FUN AND NEW IDEAS
Go to bottomPage: 1234
TOPIC:
#1177
Re:Distance Measurement using ZIlog 4 Years, 3 Months ago Karma: 0
Diego Villabruna wrote:
Hi all,
I'm trying to use a Z8 Encore Z8F0421 to drive an ultrasonic sensor SRF02 using the I2C protocol but
at the moment I'm not able to make it works.
.. omissis...

Well.. problem solved: I've got some timing errors in my implementation.

Thanks to mr for the help.


diego
Diego Villabruna (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1164
Re:Distance Measurement using ZIlog 4 Years, 3 Months ago Karma: 3
take a look at your zilog email
MR (User)
Senior Boarder
Posts: 79
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: South Florida
The administrator has disabled public write access.
 
#1161
Re:Distance Measurement using ZIlog 4 Years, 3 Months ago Karma: 0
Hi all,
I'm trying to use a Z8 Encore Z8F0421 to drive an ultrasonic sensor SRF02 using the I2C protocol but
at the moment I'm not able to make it works.

I'm working in asm using the polling method (for this first software issue is ok).
I simply plan to write three consecutive bytes (e.g. 7 bit address plus write bit + 00 + 00) and then STOP.

These are the steps I done:

- Set the I2C bus speed at 50 KHz (ok, test with a scope)
- Enable the I2C controller (I2CCTL <-80 hex)
- Prepare a data byte (I2CData <- e0 hex)
- Send the START condition (I2CTL <- c0 hex) At this point the controller start to generate data...

- I start to loop on I2CSTAT waiting for TDRE = 1 (works)

- when TDRE = 1 I load another byte into I2CDATA

- then I start another loop waiting for another TDRE = 1 that.. never arrived.

Using an oscilloscope I performed some measurements on bus (without sensor)
and I discovered that only 8 clock cycles are sent out by the i2C controller (In this way I'm not able to read the ACK bit)

It's seems that the z8 waits before the acknowledge bit.

Documentation says that this is the expected behavior when I2CDATA is empty and the STOP bit is not set,
But I write the second bytes fast enough.

I forget some steps? or something in documentation? Some suggestions?

Please also consider that I'm working in debug mode with breakpoints set (after the second loop). Can be this the problem?
At the moment the software don't foresees to touch any bits of I2CCTL register except IEN, START, STOP.

Thanks in Advance

Diego
Diego Villabruna (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1157
Re:Distance Measurement using ZIlog 4 Years, 3 Months ago Karma: 3
I would expect the code to work. The port configuration has to be verified for each z8 variant because different packaging sometimes relocates the function connection because there is so much multiplexing. I've used the 1680/2480 and recently the 4822/6422.

I use the Product Specifications PDF that comes with the ZDS to make sure. It's an awfully dull job. Memory constraints and possibly clock speed for the project also varies. Obvious, but easy to forget. The ZDS for z8, requires you to redefine a project when switching processor targets.
MR (User)
Senior Boarder
Posts: 79
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: South Florida
The administrator has disabled public write access.
 
#1155
Re:Distance Measurement using ZIlog 4 Years, 3 Months ago Karma: 0
Dear batmannemesis:

Hi! Your proposal sounds nice! (even in a ultrasonic frequency )

I couldn't obtain a Z8F042A and a US-100. A Z8F1680 I used is upper compatible to a Z8F042A, but AFs are different. I have no way to verify whether my 042A port also works well on the real environment...
Tomohiro HARAIKAWA (User)
Fresh Boarder
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1154
Re:Distance Measurement using ZIlog 4 Years, 3 Months ago Karma: 0
Hi graceshin00,

we have a full working project for distance measurement using Zilog MCU and this sensor:
www.e-gizmo.com/KIT/sonar.htm

displays available: PC (visual basic code), character lcd, or 7-segments led.

just email:
shadow.devboards@gmail.com
batmannemesis (User)
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1234
The Sample Center is managed separately
from Zilog's Customer Support services,
and therefore requires a separate login.
Acknowledged! Take me to the Sample Center.
Disable this pop-up in the future.