Go Down

Topic: is there any SHIFTOUT()? (Read 234 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

ALAA72

Dear Power_Broker

what is this github file all about?

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

ALAA72

Dear Power_Broker

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

Power_Broker

#5
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

#8
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

ALAA72

#9
Nov 10, 2019, 11:48 am Last Edit: Nov 10, 2019, 11:50 am by ALAA72
Dear westfw
but we can use USART which is synchronous with a clock. that's why it is called USART and not UART.

also

Dear Hinson685
your definition of ShiftOut() function is right. but I'm curious if both ShiftOut() and HAL_USART_Transmit() function can be identical?

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."

ALAA72

Dear MorganS

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

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

ALAA72

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

I had a project driving a printer module using ARDUINO. in that project I used ShiftOut() function to shift the data out.
then I switched to STM32F407 Discovery board. I used HAL_USART_Transmit() function to shift the data but now when I run the code, it does work as expected. it seems like HAL_USART_Transmit() doesn't shift the data out!
that's why I ask how can I make them identical???

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

Go Up