how can make twoway communication Rx Tx uart between 2 atmega?

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

 

hi

I'm planed to connect two atmega32 microcontrollers using UART. An chracter LCD is connected to the master micro on PORTC . My compiler is Code Vision AVR. I want to Send 0b11111111 by master micro to slave micro. If slave micro received it in subroutine interrupt ,how can I read receive data in while (1) loop and transmit it to master micro?

 

slave micro program

/*****************************************************
This program was produced by the
CodeWizardAVR V2.04.4a Advanced
Automatic Program Generator
http://www.hpinfotech.com
Chip type               : ATmega32
Program type            : Application
AVR Core Clock frequency: 8.000000 MHz
Memory model            : Small
External RAM size       : 0
Data Stack size         : 512
*****************************************************/
#include <mega32.h>
  #include <delay.h>
  #include <stdio.h>
  char b;
  #ifndef RXB8
#define RXB8 1
#endif

#ifndef TXB8
#define TXB8 0
#endif

#ifndef UPE
#define UPE 2
#endif

#ifndef DOR
#define DOR 3
#endif

#ifndef FE
#define FE 4
#endif

#ifndef UDRE
#define UDRE 5
#endif

#ifndef RXC
#define RXC 7
#endif

#define FRAMING_ERROR (1<<FE)
#define PARITY_ERROR (1<<UPE)
#define DATA_OVERRUN (1<<DOR)
#define DATA_REGISTER_EMPTY (1<<UDRE)
#define RX_COMPLETE (1<<RXC)

// USART Receiver buffer
#define RX_BUFFER_SIZE 8
char rx_buffer[RX_BUFFER_SIZE];

#if RX_BUFFER_SIZE<256
unsigned char rx_wr_index,rx_rd_index,rx_counter;
#else
unsigned int rx_wr_index,rx_rd_index,rx_counter;
#endif

// This flag is set on USART Receiver buffer overflow
bit rx_buffer_overflow;

// USART Receiver interrupt service routine
interrupt [USART_RXC] void usart_rx_isr(void)
{
char status,data;
status=UCSRA;
data=UDR;

if ((status & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN))==0)
   {
     rx_buffer[rx_wr_index]=data;
   if (++rx_wr_index == RX_BUFFER_SIZE) rx_wr_index=0;
   if (++rx_counter == RX_BUFFER_SIZE)
      {
  rx_counter=0;
      rx_buffer_overflow=1;
      };

   };

}

#ifndef _DEBUG_TERMINAL_IO_
// Get a character from the USART Receiver buffer
#define _ALTERNATE_GETCHAR_
#pragma used+
char getchar(void)
{
char data;
while (rx_counter==0);
data=rx_buffer[rx_rd_index];
if (++rx_rd_index == RX_BUFFER_SIZE) rx_rd_index=0;
#asm("cli")
--rx_counter;
#asm("sei")

return data;
}
#pragma used-
#endif

// Standard Input/Output functions
#include <stdio.h>

// Declare your global variables here

void main(void)
{
// Declare your local variables here

// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;

// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0xFF;

// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;

// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x40;

// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;

// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;

// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;

// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;

// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud Rate: 9600
UCSRA=0x00;
UCSRB=0x98;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x33;

// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;

// Global enable interrupts
#asm("sei")

 while (1)
      {
b=getchar();
    while(((UCSRA & (1 << UDRE)) == 0));
    UDR=b;
        delay_ms(100);
      };
}

 

master micro program

 

/*****************************************************
This program was produced by the
CodeWizardAVR V2.04.4a Advanced
Automatic Program Generator

Chip type               : ATmega32
Program type            : Application
AVR Core Clock frequency: 8.000000 MHz
Memory model            : Small
External RAM size       : 0
Data Stack size         : 512
*****************************************************/

#include <mega32.h>
#include <delay.h>
#include <stdio.h>
int a;
char s[15];
// Alphanumeric LCD Module functions
#asm
   .equ __lcd_port=0x15 ;PORTC
#endasm
#include <lcd.h>

#ifndef RXB8
#define RXB8 1
#endif

#ifndef TXB8
#define TXB8 0
#endif

#ifndef UPE
#define UPE 2
#endif

#ifndef DOR
#define DOR 3
#endif

#ifndef FE
#define FE 4
#endif

#ifndef UDRE
#define UDRE 5
#endif

#ifndef RXC
#define RXC 7
#endif

#define FRAMING_ERROR (1<<FE)
#define PARITY_ERROR (1<<UPE)
#define DATA_OVERRUN (1<<DOR)
#define DATA_REGISTER_EMPTY (1<<UDRE)
#define RX_COMPLETE (1<<RXC)

// USART Receiver buffer
#define RX_BUFFER_SIZE 8
char rx_buffer[RX_BUFFER_SIZE];

#if RX_BUFFER_SIZE<256
unsigned char rx_wr_index,rx_rd_index,rx_counter;
#else
unsigned int rx_wr_index,rx_rd_index,rx_counter;
#endif

// This flag is set on USART Receiver buffer overflow
bit rx_buffer_overflow;

// USART Receiver interrupt service routine
interrupt [USART_RXC] void usart_rx_isr(void)
{
char status,data;
status=UCSRA;
data=UDR;
if ((status & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN))==0)
   {
   rx_buffer[rx_wr_index]=data;
   if (++rx_wr_index == RX_BUFFER_SIZE) rx_wr_index=0;
   if (++rx_counter == RX_BUFFER_SIZE)
      {
      rx_counter=0;
      rx_buffer_overflow=1;
      };
   };

         a=data;
sprintf(s,"%d",a);
lcd_gotoxy(0,0);
lcd_puts(s);

}

#ifndef _DEBUG_TERMINAL_IO_
// Get a character from the USART Receiver buffer
#define _ALTERNATE_GETCHAR_
#pragma used+
char getchar(void)
{
char data;
while (rx_counter==0);
data=rx_buffer[rx_rd_index];
if (++rx_rd_index == RX_BUFFER_SIZE) rx_rd_index=0;
#asm("cli")
--rx_counter;
#asm("sei")
return data;
}
#pragma used-
#endif

// Standard Input/Output functions
#include <stdio.h>

// Declare your global variables here

void main(void)
{
// Declare your local variables here

// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;

// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0xFF;

// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;

// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x40;

// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;

// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;

// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;

// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;

// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud Rate: 9600
UCSRA=0x00;
UCSRB=0x98;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x33;

// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;

// LCD module initialization
lcd_init(16);

// Global enable interrupts
#asm("sei")

while (1)
      {
 while(((UCSRA & (1 << UDRE)) == 0));
    UDR=0b11111111;
   delay_ms(100); 

      };
}

When simulating with Proteus, the value shown on the display is zero instead of 255.

 

Last Edited: Sat. Apr 11, 2020 - 07:11 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's Codevision. It provides getchar() etc. Just use what it provides.

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

The key thing with any communication project is not to try to do both ends at once!

 

Because, when you do that and have a problem, you have no idea:

  • is the problem in the sender ?
  • is the problem in the receiver ?
  • are there problems in both ?!

 

So start with just one end, and test that against a known-good standard.

 

For serial comms, the obvious choice for "a known-good standard" is a Terminal program on a PC.

 

Probably the easiest place to start is with the AVR sending stuff to the PC

 

See https://www.avrfreaks.net/commen... - which is also in Tip #6 in my signature, below (may not be visible on mobile).

 

There are plenty of tutorials on the interwebs on how to do serial comms; eg,

 

https://learn.sparkfun.com/tutor...

 

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

In slave program i tested below code but its not working!

 

#asm("sei")
 
 while (1)
      {
b= getchar() ; 
    while(((UCSRA & (1 << UDRE)) == 0));
    UDR=b;
        delay_ms(100); 
 
       
      };
}

Can you show me how it works?

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

awneil wrote:

Because, when you do that and have a problem, you have no idea:

  • is the problem in the sender ?
  • is the problem in the receiver ?
  • are there problems in both ?!

Good advice!  The OP is doing this project in proteous, which is a SIMULATOR,  so the OP needs to learn how to set break points, and/or single step his code, tracing the flow of data from one end to the other and look to see where his assumptions go wrong!

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

My problem is on the slave side .

On the slave side, instead of the variable b, if I put a numeric value (for example 0b11111111), I get it on the master side.(display show 255).its  okay.

But I want to get the value that the master micro sends to slave micro through the RX interrupt and then save it in the variable b and send it back to the master to display.

In other words, on the slave side, I can't call the value that RX interrupt received to  the while() loop.

 

 thanks

Last Edited: Fri. Apr 10, 2020 - 01:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rezamicro wrote:

I want to get the value that the master micro sends to slave micro through the RX interrupt and then save it in the variable b and send it back to the master to display.

 thanks

 

 while (1)
      { 
    while(((UCSRA & (1 << UDRE)) == 0));
    UDR=b;
        delay_ms(100); 
      };

In the above slave code, b is declared as a global, all globals are init'd by C runtime as zero (0x00).

So you send a zero value above because you never set b to any value, let alone to 0xff! so the master will receive a zero not 0xff as you want.

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

i want to make:

1)master send 0b11111111; from while() loop

2)slave  received it from  RX interrupt.

3)slave put value to b variable

4)slave send b from while() loop

5)master  received it from  RX interrupt and show on the display.

my problem is step 3

 

How can I give the value of the interrupt received to the variable b?

b=getchar(); not working in slave micro

Last Edited: Fri. Apr 10, 2020 - 01:52 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rezamicro wrote:
3)slave put value to b variable

This part seems to be missing from code shown above

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

ki0bk wrote:
#asm("sei") while (1) { b= getchar() ; while(((UCSRA & (1 << UDRE)) == 0)); UDR=b; delay_ms(100); }; }

this code is not working.

Anyone can help me?

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

You could give in and read the manual! If you are using getchar() and putchar() your own code should not be messing with UCSRA, UDR, etc because you are isolated from this by the library code that CV provides.

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

clawson wrote:

You could give in and read the manual! If you are using getchar() and putchar() your own code should not be messing with UCSRA, UDR, etc because you are isolated from this by the library code that CV provides.

 

thanks,You are right. Can you help me how to programing the following steps?

i want to make:

1)master send 0b11111111; from while() loop

2)slave  received it from  RX interrupt.

3)slave put value to b variable

4)slave send b from while() loop

5)master  received it from  RX interrupt and show on the display.

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

If you have a licensed version of codevision it has a wizard that does interrupt based communications which would make your life easy, and get your homework done. From what I can see it looks like you are using a licensed version so you should be good to go.
Here's a hint. Rather than wasting time constantly looking for a received byte. Send your byte along with a delimiter. In the ISR look for the delimiter and set a flag that the main code can look for and when the flag sets use getchar() to look for the received byte and then echo it back to the master.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Last Edited: Fri. Apr 10, 2020 - 03:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
 while (1)
      {
b=getchar();
    while(((UCSRA & (1 << UDRE)) == 0));
    UDR=b;
        delay_ms(100);
      };
}

THis is wrong.

Getchar() takes care of everything so this:

 while(((UCSRA & (1 << UDRE)) == 0));
    UDR=b;

is unnecessary, and a part of your problem.

 

 

Your master program "might work", but as others have said, you need to test this on its own.  Since you have a licensed Proteus suite why not use the tools and send a charcter into the RX pin of the Master in simulation and see what happens.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

If I stand on the roof of a ten-story building, and start the CodeVision USART code at my feet, then with good binoculars I can see the end of the code.

If I do something sensible and use Arduino, then I only need a few lines of code:

 

  {Master}  Serial.begin(9600);

                   Serial.write(0xff);

                   if (Serial.available() )   sendToDisplay(  Serial.read(); );

 

  { Slave }  Serial.begin(9600);

                   if (Serial.available() ) Serial.write( Serial.read(); );

 

   I feel like Sisyphus, trying over and over to get AVR beginners to do the sensible thing of letting Arduino handle the hardware so that the software developer can concentrate on the application.

By the way, if you're a student and your professor insists that you can't use Arduino to do programming projects, then you should go to another school.  Because you aren't learning anything that will be of any use when 32-bit processors start selling for a dollar each.

                  

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

Simonetta wrote:
I feel like Sisyphus, trying over and over to get AVR beginners to do the sensible thing of letting Arduino handle the hardware so that the software developer can concentrate on the application.

 

And what does the student do when the instructor requires they use the tools the school requires?  Does the student tell the school that "Simonetta says....."?

 

The CV code posted of course does not need to have everything that the wizard generates.

 

Simonetta wrote:
By the way, if you're a student and your professor insists that you can't use Arduino to do programming projects, then you should go to another school.

This is nonsense advice.

 

Simonetta wrote:
Because you aren't learning anything that will be of any use when 32-bit processors start selling for a dollar each.

They actually sell for a lot less if you look around past arduinos....but then again what else is there but arduino right?

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

Simonetta wrote:

If I stand on the roof of a ten-story building, and start the CodeVision USART code at my feet, then with good binoculars I can see the end of the code.

If I do something sensible and use Arduino, then I only need a few lines of code:

 

  {Master}  Serial.begin(9600);

                   Serial.write(0xff);

                   if (Serial.available() )   sendToDisplay(  Serial.read(); );

 

  { Slave }  Serial.begin(9600);

                   if (Serial.available() ) Serial.write( Serial.read(); );

 

   I feel like Sisyphus, trying over and over to get AVR beginners to do the sensible thing of letting Arduino handle the hardware so that the software developer can concentrate on the application.

By the way, if you're a student and your professor insists that you can't use Arduino to do programming projects, then you should go to another school.  Because you aren't learning anything that will be of any use when 32-bit processors start selling for a dollar each.

                  

thanks for reply but i dont want to use  arduino....indecision

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

Simonetta wrote:
if you're a student and your professor insists that you can't use Arduino to do programming projects, then you should go to another school. 

As Jim says, this is complete nonsense!

 

If you actually want to learn programming, then doing it from scratch is a very good learning process!

 

Simonetta wrote:
Because you aren't learning anything that will be of any use when 32-bit processors start selling for a dollar each

Again, complete nonsense!

 

See: https://www.avrfreaks.net/commen...

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

wondering...why do you have your comments all away from the  code...makes it much harder to follow & to check for errors...easy to miss!

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
THIS IS MUCH EASIER TO UNDERSTAND & LOOK FOR ERRORS

TCCR1A=0x00;  // Compare B Match Interrupt: Off
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;  // Noise Canceler: Off
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;  // Input Capture Interrupt: Off
OCR1BH=0x00;
OCR1BL=0x00;

That also cuts the length greatly, so you can see all the code on the screen...you can only see maybe 60 lines on the screen, so it is also much easier to understand when a screen can show a complete routine rather than a partial routine.

Conserve precious vertical space...you have plenty of unused horizontal

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Apr 10, 2020 - 04:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

wondering...why do you have your comments all away from the  code...makes it much harder to follow & to check for errors...easy to miss!

 

Because that's how the CVAVR wizard generates it.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

Because that's how the CVAVR wizard generates it.

Bleh...very sad state of affairs! 

 

I wonder why they make it so wasteful?

Well if it is autogenerated, then less of an issue, since no errors, such as register mismatching will be present wink 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Apr 10, 2020 - 04:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm really sorry for myself.

that some of you are just thinking of making fun of me instead of helping me.

Yes, that's right. I'm a beginner in this field. And none of you who are professionals could solve this problem. angry

In fact, I wanted to use a UART-based ring network for the following project to exchange information

 

Last Edited: Sat. Apr 11, 2020 - 07:12 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rezamicro wrote:
that some of you are just thinking of making fun of me instead of helping me.

 

No one is making fun of you...

 

rezamicro wrote:
And none of you who are professionals could solve this problem.

Not our job to solve your problem.  We are here to guide you towards your goal.

 

rezamicro wrote:
I wanted to use a UART-based ring network for the following project to exchange information

Bad Idea the way you have it.  Look at RS485 communications instead.

 

Worry about that AFTER you get what you have started working first.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

Can you explain why you want a ring?

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

Save yourself a lot of extra grief....be sure to use a good 8.0000 MHz xtal, or better yet, one set to a magic freq, like 11.0592 MHz.  When you use the internal, it may not work or work only for some chips, some of the time...then you waste a lot of time chasing bugs that don't exist, or make bugs that do exist much harder to debug.   This happens way way too often.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

Thanks for the overview of the project, that really helps us, so we can help you!

JIm

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

One issue you may not have considered, now that we can see the grand plan, is your SOB character is the same as one of the possible values for your temp sensor!

SOB == zero degrees C !!!   so there is the possibility of losing sync with your data stream. 

Two ways to handle this, add a fixed offset to your temp data so temp values can not ever be zero, the master can subtract this offset to recover the true data, or..

Use a SOB character that is above any valid temp value!

LM35 has a range of -55 to 150 degrees, it may be best to add an offset so you don't have to handle neg values (i.e. signed values), keep it simple simon is how I like to do things.

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

ki0bk wrote:
Use a SOB character that is above any valid temp value!

 

Or convert everything to ASCII......  Crude, but simple and effective.  >>Just like yours truly cheeky<<

 

Right Side Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

The LM35 is a simple temp sensor to use, but needs special handling for negative temps anyway, as the ADC can not handle negative voltage inputs, so the temp sensor will need to have a positive bias in order to go to neg temps anyway, so an offset maybe inherent in the value anyway!  Perhaps negative temperatures are not required, since the OP has not shared what the design specs are for his project. This could all be moot.

Jim, yes ascii is a valid way to handle that, but increases the amount of data sent, but is easy to read/verify with a terminal program monitoring the data flow! Nice suggestion!

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

ki0bk wrote:

One issue you may not have considered, now that we can see the grand plan, is your SOB character is the same as one of the possible values for your temp sensor!

SOB == zero degrees C !!!   so there is the possibility of losing sync with your data stream. 

Two ways to handle this, add a fixed offset to your temp data so temp values can not ever be zero, the master can subtract this offset to recover the true data, or..

Use a SOB character that is above any valid temp value!

LM35 has a range of -55 to 150 degrees, it may be best to add an offset so you don't have to handle neg values (i.e. signed values), keep it simple simon is how I like to do things.

 

Jim

 

 

 

SOB=start of packet

EOB=end of packet

for evry looping i have 6 bytes date consist of sob and eob for start and end of packet  and 4 data byte d0,d1,d2,d3 for temperature.

 

 

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

rezamicro wrote:

SOB=start of packet

EOB=end of packet

for evry looping i have 6 bytes date consist of sob and eob for start and end of packet  and 4 data byte d0,d1,d2,d3 for temperature.

Yes that was what I was referring to, but you show SOB == 0, EOB == FF, zero is a valid temperature, your master can get out of sync if one or more of the slaves sends a 00 data value, as it could be mistaken as a SOB.

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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


while (1)
      {
if ( UCSRA & (1<<RXC) )
	{
		//Get the data
		char data = UDR;
		if (data==START_SYNC_BYTE)
		{
			i=0;
		}
		else
		{
			if (data != END_SYNC_BYTE )
			{
				recieveBuffer[i] = data;
				i++;
				if(i==RECIEVE_BUFF_MAX ){
	}

}
     

}

 

Last Edited: Sat. Apr 11, 2020 - 07:13 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
SLAVE MICRO

while (1)
      {

    if ( UCSRA & (1<<RXC) )
	{
		//Get the data
		char data = UDR; 

		if (data==START_SYNC_BYTE)
		{
			i=0;
		}
		else
		{
			if (data != END_SYNC_BYTE )
			{
				recieveBuffer[i] = data;
				i++;
				if(i==RECIEVE_BUFF_MAX ){   

				}
			}
			else i=0;
		}
           }

      };
}

 

Last Edited: Sat. Apr 11, 2020 - 07:13 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

rezamicro wrote:

 

SOB=start of packet

EOB=end of packet

for evry looping i have 6 bytes date consist of sob and eob for start and end of packet  and 4 data byte d0,d1,d2,d3 for temperature.

 

 

Yes that was what I was referring to, but you show SOB == 0, EOB == FF, zero is a valid temperature, your master can get out of sync if one or more of the slaves sends a 00 data value, as it could be mistaken as a SOB.

 

Jim

 

 

 

IN SLAVE MICRO I CHANGE THE SOB AND EOB

 

 

MASTER

SOB=0X00

D0

D1

D2

D3

EOB=0XFF

 

 

 

SALVE

SOB=0X01

D0

D1

D2

D3

EOB=0XFE

 

Since I didn't get a response through the rx  interrupt , I decided to write the program without using a rx interrupt . Apparently the program is correct, but it hasn't worked yet ​​​​​​​

I am trying to answer with your help smiley

Last Edited: Fri. Apr 10, 2020 - 08:36 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your code does not make sense without comments explaining what you want to do.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

jgmdesign wrote:
Crude, but simple and effective.  >>Just like yours truly cheeky<<
I was not sipping on my coffee, thank goodness...

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

rezamicro wrote:
Since I didn't get a response through the rx  interrupt , I decided to write the program without using a rx interrupt . Apparently the program is correct, but it hasn't worked yet ​​​​​​​

And how do you know the program is correct if it does not work?  surprise

 

joeymorin wrote:

jgmdesign wrote:
Crude, but simple and effective.  >>Just like yours truly cheeky<<
I was not sipping on my coffee, thank goodness...

Damn!  I'll try timing it better next pass through the WHILE() loop.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

jgmdesign wrote:

Your code does not make sense without comments explaining what you want to do.

 

JIm

First, the master micro sends a six-byte packet for the slave micro.
Then the first slave micro get the packet and changes the address of the beginning and end of the packet and  then puts the amount of temperature in its own byte. It sends packet to another slave micro.

In the last of slave micro, the address of the beginning and end of the packet is returned to normal and then sent to the master micro for display.

 

 

Last Edited: Sat. Apr 11, 2020 - 07:14 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

rezamicro wrote:

Since I didn't get a response through the rx  interrupt , I decided to write the program without using a rx interrupt . Apparently the program is correct, but it hasn't worked yet ​​​​​​​

 

And how do you know the program is correct if it does not work?  surprise

 

 

joeymorin wrote:

 

 

jgmdesign wrote:

Crude, but simple and effective.  >>Just like yours truly cheeky<<

I was not sipping on my coffee, thank goodness...

 

 

 

Damn!  I'll try timing it better next pass through the WHILE() loop.

 

 

my program for 2 micro (slave / master) and 1 byte packet is okay.

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

I recommend that you use the One-Wire temperature sensor  DS18B20 instead of the LM35.  You can string eight of the DS18B20 sensors together over a good distance and still only use one microcontroller to read all eight of the temperature values.

 

I also recommend using Bluetooth or Wi-Fi instead of UART for connecting these devices to the main CPU.   If you are a student then you should be studying the technology that will be in most-common use five years from now instead of chips that date back to the 1980s, like the LM35.  

 

   The price of the basic wireless technology is going to keep going down,  which means that it will be used in more commercial applications than stand-alone (no BlueTooth or Wi-Fi) applications.   Your future employer is going to want you to know how to design with Wi-Fi.  If you can't, then they will hire someone else for advanced designing jobs ($80,000/yr and up in the USA) and you'll be stuck in the pot-tweeking|board-swapping "technician" jobs that pay $30,000/yr or less in the USA.

 

    If you are a student then this is what you should be learning, instead of programming an individual CPU type on the register level.   The use of a certain CPU family in general embedded-system applications goes in about 15 year cycles.  For example, the 6502 was used extensively from 1975 to 1990;  the 8051-family from 1980 to 1995, and the PIC/AVR from about 1998 to the present.  The PIC/AVR will gradually be replaced by the Cortex ARM family as the raw price of this family of chips approaches that of the PIC/AVR.  There is the possibility that custom and semi-custom board designers (production units less than 500) will go to the inexpensive 32-bit CPUs with integrated Wi-Fi and Bluetooth (such as WEMOS, based on the ESP family) instead of the Cortex ARM.

  

   Again, if you're a student concentrating on embedded systems and your school is not teaching you NOW how to design with these 32-bit chips, then you should transfer to a different school.  If your embedded-sys classes have you learning the registers of an AVR using 10-year-old Mega32-based lab equipment, then you won't have the needed skills to be productive when you graduate.  And there isn't going to be anyone to teach you about this stuff when you get out of school.

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

Simonetta wrote:
Again, if you're a student concentrating on embedded systems and your school is not teaching you NOW how to design with these 32-bit chips, then you should transfer to a different school.  If your embedded-sys classes have you learning the registers of an AVR using 10-year-old Mega32-based lab equipment, then you won't have the needed skills to be productive when you graduate.  And there isn't going to be anyone to teach you about this stuff when you get out of school.

 

Why don't you start your own school since you seem to have the world all figured out?

 

The OP has decided on what they want to use.  If you cannot assist on the hardware that has been spec'd then stop trolling the thread and go waste someone elses time.  Simple as that.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

rezamicro wrote:
my program for 2 micro (slave / master) and 1 byte packet is okay.

 

Huh?

 

From your first post:

rezamicro wrote:
When simulating with Proteus, the value shown on the display is zero instead of 255.

 

Does not sound like its working from that statement.

 

Then again, a lot of your posts are not making much sense.  How about you take a step back and re-evaluate what you have, what you have confirmed works, and how you have confirmed that.  Write it all down and post it here so theres no confusion.

 

 

Also, what par t of the world are you in?  There may be a local resource(a Freak) that might be able to help you out one on one as well.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

I apologize for taking your time .

In the age of communication, I came to the conclusion that I could only help myself.

This topic will not be answered. Please close or delete it  (shift+Del).........

 

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

Brian Fairchild wrote:

Can you explain why you want a ring?

 

PLEASE DO NOT EDIT YOUR POST AFTER PEOPLE HAVE REPLIED. NOW MY POST MAKES NO SENSE.

 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

rezamicro wrote:

This topic will not be answered.

 

 

Of course it will be and can be. Moving data backwards and forwards between chips happens all the while. Sometimes they are on the same board, sometimes on different boards in the same unit, and sometimes 100s, if not 1000s. of metres apart. The princuiples ar eall the same.

 

You have a stated goal and the tools to do it. CV will generate most of the code for you. All you need to do is be clear about exactly what you wan to do and be able to write that down. From there on the coding is the easy bit.

 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

rezamicro wrote:

I apologize for taking your time .

In the age of communication, I came to the conclusion that I could only help myself.

This topic will not be answered. Please close or delete it  (shift+Del).........

 

 

Thats unfortunate.  For everyone.

 

All the best on your quest.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

Maybe you are trying to do too much all at once...a guarantee of failure, since one or two bugs makes everything collapse.

 

Does your LCD show the characters that you send it?  Get that working... make it show "hello" or "good luck" ...don't worry about external messages.  Just send a message directly from the AVR to the LCD.

Does your master unit at least send out the desired serial messages properly?  Use ASCII for everything, then you can use a terminal to see that the proper things are being spit out.  That much MUST be working, or there is no hope until it does.

Then send from the terminal TO the master, the ASCII you eventually hope the slaves will be sending out ...does that work?   Receiving is somewhat trickier.  

You can now use your working LCD to show what is being received, and/or you can echo out what is being received to the terminal.

Once the terminal is working well (rx & tx), you can replace it with a slave AVR & some smarts (message handling).

Once these things work (passing messages around), then you can move on to fiddling with sensor readings.

Get one sensor working on the unit with the LCD, so you know you have good sensor code.  Then move that code to your slaves.

See?  Doing it step-by-step make it alot easier to figure out where things go wrong.  

 

 

 

  

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sat. Apr 11, 2020 - 01:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Forget it everyone.  The OP has made it known that they will not respond.  Let's see if they calm down ad return.  If not, we tried......

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

I reread this thread as far as #22 when OP said "some of you are making fun of me" and I cannot see anything that suggests such a thing?!? Most odd.

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

   I don't need to start my own school because the only real school that people need to go to in order to learn modern embedded-system programming doesn't exist as a traditional educational establishment; it exists today as You-Tube videos that have been made by people who have already successfully done what you are trying to do.  The University of You-Tube is more important today than any University of Technology.

    Since most of the material that students learn in embedded-systems classes will be obsolete in five years, they should be learning instead the topics that will be in wide general use in five years from their graduation.  Topics like how to use and program 32-bit controllers with embedded WiFi and BlueTooth.  Learning ten year old technology in a school that you are paying for is a waste of time and money.

   If someone is paying you -- and they insist on using ten-year-old technology, then yes, learn it and use it.  But not in school.

 

   A string of eight One-Wire Temperature sensors is going to be developed and debugged faster, be more reliable, and cheaper than having a ring of eight analog sensors with each sensor having its own microcontroller.  The One-Wire Temperature sensors are as cheap as the LM35 and each one has a unique ID number.  I've never seen UARTs set up as a daisy-chain

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

Simonetta wrote:
The University of You-Tube is more important today than any University of Technology.

 

And when an employer is willing to accept that as a valid education then your pontification holds water....until then.......nope.

 

Does YouTube provide structured engineering courses for electrical engineering that explain theory, and the mathematics associated?  Maybe.  But most will not sit through hours of video with no real test to evaluate knowledge, so is industry to trust a person that says they watched a video or someone that actually(or may have) sat in a class and learned the theory behind the engineering?  It could be argued whats the difference, and I would agree.  But as I said before, untill a company is willing to accept YouTube University  ten year old tech prevails.

 

YMMV.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

I have worked on security systems that used daisy chain. Designed hardware and wrote 8051 code for said system. It used a several byte messages that constantly circulated through the system. Worked just fine and provided tamper resistance (good attribute for security system). It happened to use RS422 but that was only the transport mechanism because of long distances; for short distances, RS232 would have worked just fine. 

 

All that said, a crucial key to a ring system is protocol. Protocol, protocol, protocol. THE crucial piece. In this case, the messages were 3 bytes: a destination address, a source address. and a command. The start byte had the MSBIT set, while the other two did not. That reduced addresses to a range of 0-127 which was acceptable for that system. Each device was responsible for removing its own messages from the ring. There were extensions that added several bytes to allow transport of ASCII text to write to various things. 

 

The short of it is that ring systems CAN work with careful design and careful hardware implementation.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

The OP has stated they will not answer so all of us bickering at this point is useless.

 

I'll leave it open for a few more days, but if the op is still quiet on Monday, and members keep piling it on....

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user