# Do I understand the time chart of the signals?

Welcome!
There is a thermal head:

For management, there are here's the timing diagram:

Connected to Arduino, do so:

1. Set the level pin of the input (0 or 1 as I need)
2. Wait 10 MS
3. Establish a high level of the pin synchronization
4. waiting 10ms
5. Set on low ping sinkronisasie
6. loop 1-5 until all the data is sent
7. Set on low ping overwrite
8. waiting 10ms
9. Establish a high level of Pina overwrite
10. Waiting 10ms
11. Establish high level pin Gating
12. wait 10 MS
13. Set on low pin Gating
14. Cycle 11-13 Gating all 6 pins of the gates

Though in the end it works but displays garbage, which I can not understand where wrong.
July 9th 19 at 13:56
July 9th 19 at 13:58
Solution
Not so.
Data is loaded into the shift register unit on the rising edge of the clock signal.
Roughly speaking, connect DI to MOSI (SPI) CLK to SCK (SPI), download a certain number of bytes (I would guess that it will either (384/3 = 128 bits) or (384 / 6 = 64 bits). That is, 16 or 8 bytes. Can download and 16, the excess will be ejected from the register. Suggest shipping the value 0x55 - so you can see the pixels one by one.
Then, the strobe LATCH (pull it down) at an arbitrary time (enough to put next to the team of set and reset pins).
To submit a team selection for the appropriate keys - STB1~STB6 at a given time.
To stretch the paper.
Look at the result.

Thanks for the article!
I just don't quite understand about the "chunked"
and SPI is busy.
Could you correct my algorithm using pull pins? - darrell commented on July 9th 19 at 14:01
: SPI busy times, and about the UART on the megahit I don't remember exactly, it's usually done this way:
Define the constants:
#define CLK (1< - Lyric_Turner56 commented on July 9th 19 at 14:04
Riveted the website.. - Lyric_Turner56 commented on July 9th 19 at 14:07
At the beginning we initialize the ports. I assume that Pina DI = PORTA.0, SCK = PORTA.1, LATCH = PORTA.2
Pins ST0~ST5 - already own.

//Somewhere in initialization:
DDRA |= 0x07;
//Output function of the byte. Vytaskivaya forward high bit.
//For example 10110000 will be transferred to the leftmost bit forward.
void SendByte(uint8_t byte) {
uint8_t i;
for (i=0;i<8;i++) {
if (byte & 0x80) {
PORTA |= 0x01;
} else {
PORTA &= ~(0x01);
};
PORTA |= 0x02;
PORTA &= ~(0x02);
byte = byte << 1;
};
PORTA |= 0x04;
PORTA &= ~(0x04);
};
- Lyric_Turner56 commented on July 9th 19 at 14:10
Ugh. Now all the formatting is eaten. - Lyric_Turner56 commented on July 9th 19 at 14:13
: so after all the turns, isn't it? I bitwise pins pull that byte directly. But thanks for the feature - to Ardence I just pass the bytes now instead of 384 bytes per row will go 48 =)
About garbage - I connected the wrong pins. The garbage disappeared. - darrell commented on July 9th 19 at 14:16

Find more questions by tags MicrocontrollersElectronics