Go Down

Topic: is there any SHIFTOUT()? (Read 437 times) previous topic - next topic

alaa72

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?

Power_Broker

"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

Power_Broker

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).
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

Power_Broker

#3
Nov 10, 2019, 08:28 am Last Edit: Nov 10, 2019, 08:28 am by Power_Broker
yes, but what does it do with comparing STM32F407 function, HAL_USART_Transmit()?
Literally the same thing, just better  :)

Check the example code in the readme
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

lastchancename

Quote
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
Experienced responders have a nose for laziness, (they were beginners once)... Sure, there are trolls, chest-beaters, and pretenders - but the help you'll get here is about as good as it gets - if you try to help youself!.

westfw

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.

Hinson685

#6
Nov 10, 2019, 10:02 am Last Edit: Nov 12, 2019, 08:47 am by Hinson685
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

MorganS

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.
"The problem is in the code you didn't post."

Power_Broker

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?
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

Power_Broker

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?...
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

Power_Broker

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
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

Power_Broker

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.
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

Go Up