This is first part of my instructable (second part abaut atmega8 standalone and its programing https://www.instructables.com/id/Atmega-8xx8-Standalone-nocrystal-Like-Arduino-Prog/ )
What we have
1. Dead brain in SCHULZE HA5070 printing press
2. Clean atmega8 MCU
3. Skills in Arduino programming
4. Control panel with 6 buttons (+one button pedal button)
6. Work table
1. Pressure valves work on 24 V
2. ATMEGA 5V
3. Main power 35V (i really don’t know for what) Conversion 35-to-5 and 35-to-24
4. No filters for input and output channels. No optocouples. This was the reason why original MCU died
5. No hardware endpoints. Machine can miss stop -point....
6. User before start work must move linear printing part for start position for selected program.
7.... bugs bugs and bugs
Algorithm for moving
Step0 Move UP
Step1 Move Left\Right (Program 1 or 2)
Step2 Move DOWN and wait 0.4s (400ms)
Step3 Move Right\Left (Program 1 or 2)
Step4 Move UP
You don’t know perfectly what inputs\outputs do. You don’t know what logical level needed for moving You can’t use delays in movements. Moving is too fast And you don’t know anything about “how this junk work”
All inputs\outputs and its states was discovered using experiment.
Program was written in 8 hours. Program was updated 2 times for user requirements.
Counter was not implemented yet. In programming process was lost 1 MCU
Step 0: check this link for standalone ATMEGA8 and its programming (second part of instructable)
Step 1: MUST-READ ATMEGA8 - Arduino UNO pinnout
Step 2: Arduino sketch and HEX
Step 3: Full original datasheet
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: MUSTREAD ATMEGA8 - Arduino UNO Pinnout
Next - check your datasheet. (pic2-pic4)
I spend 6 hours for decoding signals. Low mean valfe is CLOSED, HIGH mean valve is open(LOW - preassure will grow and parts will move. HIGH - prassure will fall and move will stop)
Note. That after each move you'll need to OFF valve(HIGH). If valve will powered on long time - power source will be reheated and die.
#define DOWN A5//down pc5
#define RIGHT_POS A4//move from left to right pc4
#define LEFT_POS A3//move from right to left pc3
#define UP A2// pc2 //up
//A1//out uncnown pc1
//A0//out2 uncnown pc0
#define RIGHT_STOP 12//
#define LEFT_STOP 11// pb3
#define D10 10//UP this button unused pb2
#define D9 9//DOWN this button work but unused pb1
//buttons main pannel(input)
#define D0 0// start pd0
#define D1 1// stop emergency pd1
#define D8 8//down pb0
#define D7 7//up pd7
#define D6 6//zero counter this function not implemented yet pd6
#define D5 5//direction (program 1 or 2) pd5
#define D2 2//line for counter scheme pd2
#define D3 3//line for counter scheme pd3
#define D4 4//line for counter scheme pd4
Step 2: Arduino Scetch and HEX
Scetch and hex for ATMEGA8 with internal 8mhz oscilator