Atmega instead PC program

Go To Last Post
23 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
I have a device that be controlled by a simple program on my PC via com port.
I want to omit PC and do this work by a keyboard and Atmega. Is it practical or I have to use PC and program all time?

ps: By Codevision I could read the Hex code which was sent from pc to my device so i know what I need to sent.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome to AVRFreaks Majid.

 

I guess the answer to your question depends...

 

So you wish to replace the PC and its code with a microcontroller which will then "talk" with the device that needs to be controlled. Have I got it right?

 

Practicality can depend very much upon an individual's perception of the term. Doing it for a single site might be seen to be impractical, but for 100's of sites a great advance.

 

When you mention HEX code I understand this to mean the serial data strings that pass from the PC to and from the device. I would not describe this as code. And Codevision presumably has been used simply to capture and record these serial data exchanges.

 

Have you captured ALL the possible serial data exchanges? Including the error conditions?

 

Back to you.

 

Ross

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Hi dear,

 

As you see in below, it is a simple program on my PC which just set the frequency of device. I type my desire frequency then select "program" button. If my device`s frequency is set correctly so I will see a message as "Done" otherwise we will see "Problem in programming" message.

 

The codes which have been sent by PC via TX port of RS232 and the message from device to PC via RX port of RS232 have been seen by connect this ports to another COM port and read the HEX codes by Codevision (see the below picture and red wire). Each frequency has the unique code that if I can send it by Atmega I think we can use microcontroller instead PC.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Seems straight forward.

 

Commands are sent to your device via an RS232 serial line.

 

If the inputs are just digits (0...9) and two other keys ("Program" and "Exit"), you would not need a full qwerty keyboard.

 

Is the manual covering the commands for the "device" available? Make model perhaps?

 

extra: Is the decimal "." required? And a backspace for corrections?

 

I would probably do it with a 4 x 4 keypad and a 16 x LCD on an arduino

Ross McKenzie ValuSoft Melbourne Australia

Last Edited: Fri. Nov 15, 2019 - 07:19 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Gotta love the CNC machined enclosure!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes you are right I can use simple keyboard but Unfortunately there isn’t manual for device, Can I trust the HEX codes which I have gained from Codevision and write it on Atmega and send them to device?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you trust the HEX codes? We don't know! The unit does not know if there is a PC or whatever connected to it - send the right data and it should work. Only you know the right data!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

majid.conf wrote:
Can I trust the HEX codes which I have gained from Codevision and write it on Atmega and send them to device?

 

Well we don't know your skill level to be able to conclude if you are capable of doing this... do we?

 

To prove that your captured code is correct, could you enter it into a program like "Realterm" and then manually send it to the device and confirm, or otherwise if it works. That is how I would start if it was my project. What baud rate does it operate at?

 

extra: 7.95 GHz is not a trivial operating frequency. Is this a programmable oscillator? Do you have a means of confirming that the device has changed to the commanded frequency?

Ross McKenzie ValuSoft Melbourne Australia

Last Edited: Fri. Nov 15, 2019 - 09:44 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What baud rate does it operate at? Baud rate is 9600.

Is this a programmable oscillator? My device is a programmable synthesizer.

Do you have a means of confirming that the device has changed to the commanded frequency? Yes I can see the result by two way, first by read message which comes back from synthesizer and second by looking at a spectrum analyzer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Excellent. So now you have a means of testing if the captured commands are sufficient. Use Realterm to send the captured command at 9600 and see that you receive the synthesizer's correct response. Easy peasy... as the saying goes.

 

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

Last Edited: Fri. Nov 15, 2019 - 09:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you using an older PS2 keyboard  (purple connector - 6 pins), or a newer USB keyboard?   The PS2 keyboard is straightforward, but the USB is difficult.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi again,

 I tried to sent the codes by ' Realterm '. I had captured this codes from PC to Atmega16 via "Realterm".

Not only it didn't been programmed but also i couldn't connect to its by previous software again. sad

Do you think there is an important thing that I hadn't considered that?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi again,

I tried to send the codes by "Realterm". I had captured this codes from PC to Atmega16 via "Realterm" in advance.

Not only it didn't been programmed but also I couldn't connect to it by previous software again. sad

Do you think there is an important thing that I hadn't considered that?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There's an echo in here!

 

As noted in your duplicate thread - https://www.avrfreaks.net/forum/... - you've clearly sent something "invalid" to the device, and that has "broken" it!

 

majid.conf wrote:
Do you think there is an important thing that I hadn't considered that?

Clearly - YES!

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don’t think so

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Because I don’t change the program of Atmega16 in synthesizer. I have just sent wrong commands to it's usart port.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

majid.conf wrote:
I don’t think so

In reference to what?

 

 

majid.conf wrote:
Because I don’t change the program of Atmega16 in synthesizer

Again, in reference to what?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Dec 4, 2019 - 09:49 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When I changed the interface board with another one, the synthesizer worked properly. So all problem related to Atmega16 on the interface board.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Still no idea what you're referring to, or how it relates to previous posts.

 

I wrote a tutorial on how to reply in the forum:

 

https://www.avrfreaks.net/forum/man-forum-how-reply-post-forum

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you dear.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

majid.conf wrote:
When I changed the interface board with another one, the synthesizer worked properly. So all problem related to Atmega16 on the interface board.

 

Well, so now you know the interface board has a protection scheme that self-destructs when hacking attempts are detected.

Personally, I'm not a fan of self-destruct protection, it reminds me of that time with FTDI: https://arstechnica.com/informat...

 

But, it's the manufacturer 's decision. You should use a logic analyser to capture the transaction instead of something crude like a serial terminal program. And then have a good look at it, maybe it just seems serial data but has some "anomalies" hidden.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:
maybe it just seems serial data but has some "anomalies" hidden.

Indeed.

 

A terminal may not show non-printing codes

 

A terminal will not show timing.

 

If OP used just one terminal to just monitor what the PC sends - that would not show if there are any important responses from the unit.

 

etc, etc, etc ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...