is there any SHIFTOUT()?

Hi there!

I was working with a code to transfer some data. first I used ARDUINO and the function ShitOut() to shift the data to my Data pin. then I switched to STM32F407 Discovery board and I realized there is a function called HAL_USART_Transmit(). are these two functions identical? what are their main differences?

Serial.write()

You might be interested in using this easy to use, fast, and reliable serial data transfer library.

ALAA72:
what is this github file all about?

It’s not a file, it’s an Arduino library - you can even download it in the Arduino IDE “Libraries Manager”.

Basically, one Arduino sends data to the library, the library “packetizes” the data and sends it via USART to another Arduino running the same version of the library. The receiving Arduino then uses the library to “depacketize” the data and allow the main Arduino code to access the data received.

The readme explains the library and it’s example in as much depth as needed (if you disagree, let me know and I can edit it).

ALAA72:
yes, but what does it do with comparing STM32F407 function, HAL_USART_Transmit()?

Literally the same thing, just better :slight_smile:

Check the example code in the readme

I used ARDUINO and the function ShitOut() to shift the data

I believe the earliest references to ShitOut() were by IBM in the 1960s
The called it GIGO, an abbreviation of Garbage In Garbage Out

Normally “shiftout” is a synchronous output that outputs both data and a clock signal, usually as fast as possible on any two pins, while UART functions output on a single pin (“asynchronously”) on specific pins associated with the hardware, at speeds controlled by previous configuration.

This function starts at either the most significant or least significant bit in a byte value, and shifts out each byte in order onto a data pin. After each bit is written to the data pin, a separate clock pin is pulsed to indicate that the new bit is available DGCustomerFirst

I think you answered your own question. If you program them to be identical then they are identical. One of them simply uses more hardware resources and less software.

ALAA72:
I know that I should make them identical but I don't know HOW?????

What was wrong with using Serial.write()?

What are you trying to do in your project? Are you trying to use USART?

I'm going to ask this once more and ONLY once more: Are you trying to use USART?

If so, what is wrong with using Serial.write()?

If not, what EXACTLY is the interface with the printer? Is it RS-232? Is it USB? Is it SPI?...

ALAA72:
yes I do want to use USART, but not in ARDUINO IDE! that's why I can't use Serial.Write()!

Why are you so agitated that I don't know something you didn't tell me in the first place?!?

That doesn't even matter - if you're using the core arduino libraries, you can use Serial.write() in ANY IDE

Sorry, it's all good - effective communication over text can be difficult.

Yes, you can use the Arduino IDE to program your board. Take a look at this.

Arduino is NOT a language - it's C++ with some wrapper logic. Therefore, you can use Arduino's (C++) libraries with other C++ compilers as long as the compiler works for your board's architecture.