Mturk Jobs

Mturk Jobs
Mturk Jobs

Tank

Sunday, May 19, 2019

How I Made a Virtual Oscilloscope and Won 1000$ on a Worldwide Contest

Yes. This is an old memory, but remembering good old memories can be a positive act to keep you fresh and motivated.

Here is my story of how I managed to win a prize on a worldwide design contest from Renesas.




At the year of 2008 , I found an advertisement in Appliance magazine about a free kit from a Microcontroller company called Renesas.

I really wanted to get this development kit. It was dedicated to motor control. I registered for this kit but unfortunately it was available only in USA and Canada.

However, my email was added in the company's clients database. Next, the company started a design contest at the same year called Renesas HTS Design Contest 2008.



The company invited me to participate in this design contest. It was a world wide contest which included shipment of free development kit to each eligible participant.

First I was admired by the idea itself of receiving a free development kit for the contest. I wanted to have this kit to learn more about Embedded C programming and to learn the Renesas technology which was new to me until that time.


To be eligible to receive the kit, there was a short demo for the company's other educational boards over a Virtual Lab environment. Then you are asked few questions to qualify for receiving the kit.

I passed through the stages of qualification and waited to receive the kit. When I received it I started to develop my design right away.


The company made a very good idea for improving the challenge through the launch of a forum for the challenge.

Each participant posted the idea of his entry and provided some technical details about it . This idea was very helpful and motivational. Any visitor or another participant can see your posted details and get admired with it or comment on it.





My design was a Multichannel Oscilloscope. The idea was very simple. I made the analog signals read by the analog-to-digital converter of the Microcontroller M16C ( on which the board is based )


The M16C has many A/D inputs but and there were 3 of them available in the challenge board.
The signals values were converted into digital in the Microcontroller and they were sent to a PC based client software which incorporated the display of a virtual Multichannel Oscilloscope.



Brief:

This project is a simple implementation of a 3 input channel oscilloscope. The Neutrino development kit has 3 available A/D inputs (including the photo-resistor).


Description:

The A/D inputs are used as analog signals input port; they are converted into the M16C microcontroller in the AD repeat mode. The host PC then reads the digitized number in the three registers of the each AD channel. The host draws the signals on the virtual oscilloscope interface.




Hardware:

The three A/D inputs are:

1- AN1 ( connected to the photo resistor )
2- AN4 ( connected to the kit ‘s I/O connector )
3- AN5 ( connected to the kit ‘s I/O connector )

The Kit I received form Renesas had i/o ports and some of them are analog input.

You can buy another Renesas Development kit from eBay.

I connected pin headers to the analog input ports.




Firmware:

Addresses of the three registers that contain digitized signals are


AN1 3C2h 962
AN4 3C8h 968
AN5 3CAh 970



Here is part of Firmware code:



Description: Initialization of a AD converter on AN1
*****************************************************************************/
void InitAD( void )
{
// adcon0 = 0x09; /* sw trigger, repeat mode, AN1 */ 
// adcon1 = 0x20; /* vref connected, 8 bit mode */
// adcon2 = 0x01; /* P10 group, sample and hold */

adcon0 = 0x09; /* sw trigger, repeat mode, AN1 */ 
adcon1 = 0x20; /* vref connected, 8 bit mode */
adcon2 = 0x01; /* P10 group, sample and hold */

adst = 1; /* start conversion */
}








Software:

The host PC runs a VB express program which read from the mentioned addresses on the user selection of the desired input port and handles this input data to a virtual oscilloscope class which draws the signal in real-time.

The user selects the input channel by a radio box. The result is loading the analog-to-digital control register 0 (adcon0 Address 982) with one of a three inputs according to the desired input port:

AN1 49h
AN4 4Ch
AN5 4Dh




From the PC based client, the user can choose the input channel to be displayed on the virtual oscilloscope and the rate at which it is displayed.



Here is part of Visual Basic.net code ( Running on PC )

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click


If Button2.Text = "Run" Then
Button2.Text = "Stop"
Button1.Enabled = False
Button4.Enabled = False


Dim D1(2) As Double
' Dim Db As Double
Dim i As Integer

ScopeStarted = True

D1(0) = 0

Do

''''''''''''''''''''''''''''''''''''''''''''

hts.GetMemory2(lBegin, lEnd, lDisplayWidth, vMemData)

outValue = vMemData.GetValue(0)


D1(0) = outValue * 0.01953125

TextBox1.Text = outValue
TextBox2.Text = D1(0)

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

For i = 0 To 10000 Step 1


'Call ExternalNext(scopehandle, Db)
Call ShowNext(scopehandle, D1(0))

Next i

Loop Until (Not ScopeStarted)

Else
Button2.Text = "Run"
Button1.Enabled = True
Button4.Enabled = True
ScopeStarted = False
End If
End Sub





Before the last day of the deadline of the contest I submitted the source code for the Microcontroller side (written in Embedded C ) and the source code of the PC client (written in Visual Basic.Net) .


The results of the contest were announced on Renesas DevCon 2008.

I've got the 4th honorable mention prize for my entry "Multichannel Oscilloscope".



This contest was very challenging and rewarding. Thanks to Renesas who has helped me through all this contest.


Location for the HTS 2008 projects:



http://renesasrulz.com/design_contest_archives/renesas_2008_hew_target_server_design_contest/m/mediagallery/276.aspx





No comments:

Tank