Master Slave serial with interrupt

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all.
Away from my workshop bored me so I made this project for fun.
Feel free for discussion to improve it.
.
The main goal is to do 2 MCU comm using bitbang serial if all the peripheral are being used.
The master is controlling the slave but the slave can interrupt anytime.
.
In here I use a button as slave request simulation.
The master sending data periodically but the slave can request to be read immediately.
.
It's 8 bit but can be easily expanded to 32 bit.
Since I don't have all the hardware at the time, I use Proteus to do the work.
The hardware should be faster than Proteus.
The MCU clock is free to choose, the higher will faster the comm.
I used 1 Mhz.
.
Pardon me if there's a typo ;)

Attachment(s): 

I don't know why I'm still doing this hobby

Last Edited: Fri. Mar 26, 2021 - 06:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How on earth does that work? Master.c calls Serial_dual_init() and Serial_send() but when it #include's serial.h those API are not exposed? So how can it perform linkage??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
So how can it perform linkage??

Functions have external linkage, unless specified 'static' - so the Linker will be able to find them.

 

But there will be no checking that the return value and/or parameters match.

 

Probably, compiling Master.c gives "implicit declaration" or similar warnings ... ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Corrected.
Missed the function prototype.
Edit: I don't know why it keep cutting the few last line?
Edit2: I upload the txt file and the few last line not corrupted. Dunno why.

I don't know why I'm still doing this hobby

Last Edited: Fri. Mar 26, 2021 - 02:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No no Andy, I mean the "implicit delcaration". It will not generate code to link passing and consuming the right parms and return value.