FUN AND NEW IDEAS
Go to bottomPage: 1234
TOPIC:
#1147
Re:Distance Measurement using ZIlog 2 Months, 3 Weeks ago Karma: 0
Dear graceshin00:

OK. We now understand that the processor has given and been fixed.

Please tell us few more things.

* Are you going to design your hardware (I mean circuit or schematic) from now on, or it is already given? If given, please give us the schematic.

* Can you choose your favorite supersonic sensor, or it is already given? If given, please give us the part number.
Tomohiro HARAIKAWA (User)
Fresh Boarder
Posts: 8
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1148
Re:Distance Measurement using ZIlog 2 Months, 3 Weeks ago Karma: 0
The sensor that im going to used is this
www.e-gizmo.com/KIT/sonar.htm
an Ultrasonic sonar sensor

also the schematic your telling is not given but the controller that im using is this
www.e-gizmo.com/KIT/Z8duino.htm
a z80402A with an arduino hardware pin layout.

and i want to display the measured distance to 7 segments.. thats what im thinking about.l
graceshin00 (User)
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1149
Re:Distance Measurement using ZIlog 2 Months, 3 Weeks ago Karma: 0
Fortunately I had a 28-pin version of Z8F1680 microcontroller (upper-comatible with a Z8F042A) in my parts box, so I bought some other missing parts in Akihabara on the returning way of business meeting in Tokyo yesterday.

I think you wish to implement an circuit like the following, right?


Four 7-segment LED has 28 (or 32, including periods) elements, but there aren't so much of remaining pins on your processor. The four-digit LED shown in the video is prewired and molded in a single package, but is equivalent to four ordinary 7-segment LEDs. It's not an intelligent module that can handle multi-digit decimals or alphabets.

The circuit shown in the video performs dynamic displaying. Four digits are lit one after another in rapid-fire (not simultaneously).

To drive LEDs, I recommend to use PORT C since the port can directly drive LEDs without any external resistor.
Code:


#include <eZ8.h>

#define SEGMENTS 0xff

void init()
{
  LEDEN = ~SEGMENTS; // Clear LED enable flags
  LEDLVLL = SEGMENTS; // Brightest
  LEDLVLH = SEGMENTS; // Brightest
}



You have to choose an anode-common LED since LED driver built in Z8 is a sink driver. The LED I used above is as follows:
www.optosupply.com/UploadFile/PDF/osl10561-xx.pdf

Let's start from single digit. Connect A, B, ... , G, DP to PORTC0, C1, ... , C6, C7, respectively. Also connect common anode to Vcc (3.3V) in this time.

Code:


include <eZ8.h>

#define SEGMENTS 0xff

void init()
{
  LEDEN = ~SEGMENTS; // Clear LED enable flags
  LEDLVLL = SEGMENTS; // Brightest
  LEDLVLH = SEGMENTS; // Brightest
}

void main(void)
{
  init();
  LEDEN = 0x5b;
  while (1);  // loops forever (stop execution)
}



The code will display "2" in the LED.

I read a product specification of Z8F042A, but I don't know whether Z8duino board or firmware occupies some resources or not.

I'm not sure whether the above code works in your environment, so please notify me if you reached here.
Tomohiro HARAIKAWA (User)
Fresh Boarder
Posts: 8
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1152
Re:Distance Measurement using ZIlog 2 Months, 3 Weeks ago Karma: 0
Thanks a lot...
Yeah the video is what i really want to do of our instructor..

the codes you post works on my zds but I did not yet try it in the hardware..
graceshin00 (User)
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1153
Re:Distance Measurement using ZIlog 2 Months, 3 Weeks ago Karma: 0
Dear graceshin00:

Yes. We can verify whether the code can be successfully compiled, but you are only the person that can run on the real hardware. Hope that you can obtain an anode-common 7-segment LEDs somewhere and succeed to display '2' on the LED. I'm waiting for your next report.

The ultrasonic sensor I'm using is HRLV-MaxSonar.

The sensor has three types of outputs: UART, Analog Voltage, and Pulse Width. I'd like to use analog output in the beginning because it enables us to talk about the mesurement without knowing the clock speed of your board, but the ADC results of Z8F1680 are not stable on my testboard.

Then I tried to measure the pulse width. I can show both ways for you: (1) software loop, and (2) utilizing gated mode of a timer module.
Tomohiro HARAIKAWA (User)
Fresh Boarder
Posts: 8
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 2 Months, 3 Weeks 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: 8
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1234