Autor Tema: alguien sabe como manejar la libreria de codigo manchester en miKroc  (Leído 3211 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado marturetjulio

  • PIC10
  • *
  • Mensajes: 44
alguien sabe como manejar la libreria de codigo manchester en miKroc
« en: 27 de Septiembre de 2009, 16:51:16 »
hola a todos los amigos del foro..
mi problema es que ya probe la libreria manchester del mikroc y funciona muy bien... con los ejemplos que ellos tienen.. estos son y este es el circuito

ESTE ES EL CODIGO DEL TRANSMISOR:
 /*
     This code shows how to use manchester library for sending data. The
     example works in conjuction with appropriate receiver. This node sends the
     word "mikroElektronika" using manchester encoding.
      MCU:             PIC16F877
     Dev.Board:       EasyPIC4
     Oscillator:      XT, 04.000MHz
       */

unsigned short
 i, ch;
char s1[] = "mikroElektronika";
void main() {
  INTCON.GIE = 0;                   // Disable interrupts
  Man_Send_Config(&PORTC,6);        // Initialize manchester sender

 while (1)
    {
      Man_Send(0x0B);               // Send start marker
      Delay_ms(100);                // Wait for a while
      ch = s1[0];
      i = 0;
     
      while (ch != 0)               // string ends with zero
        {
         Man_Send(ch);              // Send char
         Man_Send(ch);
         Delay_ms(90);
         i++;
         ch = s1;
        }
      Man_Send(0x0E);               // Send end marker
      Delay_ms(1000);
    }
}

ESTE ES EL PROGRAMA DEL RECEPTOR

/*
      This code shows how to use manchester library for receiving data. The
     example works in conjuction with transmitter which sends the word
     "mikroElektronika" using manchester encoding. During the receive process,
     message letters are being written on the LCD.
 * Test configuration:
     MCU:             PIC16F877
     Dev.Board:       EasyPIC4
     Oscillator:      XT, 04.000MHz
     Ext. Modules:    Superhet receiver on some household-use frequency (e.g.
                      433MHz) - OPTIONAL
     SW:              mikroC v8.0
 */

unsigned short
 ERR,
 *error,
 ErrorCount,
 temp;

void main() {
  ERR = 0;
  error = &ERR;
  ErrorCount = 0;

  ADCON1 = 0x0F;                           // Set AN pins to Digital I/O
  Lcd_Config(&PORTB,1,0,2,7,6,5,4);                        // Lcd_Init_EP4, see Autocomplete
  Lcd_Cmd(LCD_CLEAR);

  Man_Receive_Config(&PORTC, 7);           // Configure and synchronize receiver
  while (1) {
      Lcd_Cmd(LCD_FIRST_ROW);
      while (1)                            // Wait for the start marker
        {
          temp = Man_Receive(error);
          if (temp == 0x0B)                // Start marker, see Transmitter example
            break;                         // We got the starting sequence
          if (ERR)                         // Exit so we do not loop forever
            break;
        }
      do
        {
          temp = Man_Receive(error);       // Attempt byte receive
          if (ERR)
            {
              Lcd_Chr_CP('?');
              ErrorCount++;
              if (ErrorCount > 20)
                {
                  //Man_Receive_Init(&PORTB);
                  // alternative:
                  temp = Man_Synchro();
                  ErrorCount = 0;
                }
            }
          else
            {
              if (temp != 0x0E)              // End marker, see Transmitter example
                Lcd_Chr_CP(temp);            // Don't write the end marker on LCD
            }
          Delay_ms(25);
        }
      while (temp != 0x0E) ;
   }
}

y este es  el circuito
Expeciencia es simplemente el nombre que le damos a nuestros errores!!!

Desconectado marturetjulio

  • PIC10
  • *
  • Mensajes: 44
Re: alguien sabe como manejar la libreria de codigo manchester en miKroc
« Respuesta #1 en: 27 de Septiembre de 2009, 17:04:20 »
 bueno me respondo yo mismo...jeje...ese que coloque anteriormente es el ejemplo que da miKroc... ahora...este es el ejemplo que yo edite...veran lo que deseo es enviar la informacion del teclado y transmitirla asi como en el ejemplo anterior trasmiten el mensaje... pero no envia nada alguien me puede ayudar..porfa me he partido el coco y no  se como hacer para que envie lo que uno escribe del el teclado de 4x4...

ESTE ES EL TRANSMISOR

/*
 
 * Description:
     This code shows how to use manchester library for sending data. The
     example works in conjuction with appropriate receiver. This node sends the
     word "mikroElektronika" using manchester encoding.
 * Test configuration:
     MCU:             PIC16F877
     Dev.Board:       EasyPIC4
     Oscillator:      HS, 04.000MHz
     Ext. Modules:    Superhet transmitter on some household-use frequency (e.g.
                      433MHz) - OPTIONAL
     SW:              mikroC v8.0
 * NOTES:
     - If you decide to try this example(s) with transmitter/receiver modules,
       make sure that both transmitter and a receiver work on the same frequency!
 */

unsigned short
ch, kp;
void main() {
  Keypad_Init(&PORTB);
  INTCON.GIE = 0;                   // Disable interrupts
  Man_Send_Config(&PORTC,6);        // Initialize manchester sender

 while (1)
    {
      kp = Keypad_Read();
      Man_Send(0x0B);               // Send start marker
      Delay_ms(100);                // Wait for a while
      ch = kp;
      Man_Send(ch);              // Send char
      Delay_ms(90);
      Man_Send(0x0E);               // Send end marker
      Delay_ms(1000);
    }
}

ESTE ES EL CODIGO DEL RECEPTOR

/*
  * Description:
     This code shows how to use manchester library for receiving data. The
     example works in conjuction with transmitter which sends the word
     "mikroElektronika" using manchester encoding. During the receive process,
     message letters are being written on the LCD.
 * Test configuration:
     MCU:             PIC16F877
     Dev.Board:       EasyPIC4
     Oscillator:      HS, 04.000MHz
     Ext. Modules:    Superhet receiver on some household-use frequency (e.g.
                      433MHz) - OPTIONAL
     SW:              mikroC v8.0
 
 */

unsigned short
 ERR,
 *error,
 ErrorCount,
 temp;

void main() {
  ERR = 0;
  error = &ERR;
  ErrorCount = 0;

  ADCON1 = 0x0F;                           // Set AN pins to Digital I/O
  Lcd_Config(&PORTD,1,0,2,7,6,5,4);    // Lcd_Init_EP4, see Autocomplete
  Lcd_Cmd(LCD_CLEAR);

  Man_Receive_Config(&PORTC, 7);           // Configure and synchronize receiver
  while (1) {
      Lcd_Cmd(LCD_FIRST_ROW);
      while (1)                            // Wait for the start marker
        {
          temp = Man_Receive(error);
          if (temp == 0x0B)                // Start marker, see Transmitter example
            break;                         // We got the starting sequence
          if (ERR)                         // Exit so we do not loop forever
            break;
        }
      do
        {
          temp = Man_Receive(error);       // Attempt byte receive
          if (ERR)
            {
              Lcd_Chr_CP('?');
              ErrorCount++;
              if (ErrorCount > 20)
                {
                  temp = Man_Synchro();
                  ErrorCount = 0;
                }
            }
          else
            {
              if (temp != 0x0E)       // End marker, see Transmitter example
              Lcd_Chr_CP(temp);     // Don't write the end marker on LCD
            }
          Delay_ms(25);
        }
      while (temp != 0x0E) ;
   }
}

y este es el circuito como conecto el teclado
Expeciencia es simplemente el nombre que le damos a nuestros errores!!!

Desconectado marturetjulio

  • PIC10
  • *
  • Mensajes: 44
Re: alguien sabe como manejar la libreria de codigo manchester en miKroc
« Respuesta #2 en: 29 de Septiembre de 2009, 21:53:08 »
hola administradores del foro y demas colaboradores quien pueda ayudarme...ayudenme con este problema que tengo  no encuentro como solucionarlo...
 saludos a todos los integrantes del foro...espero me puedan ayudar..
Expeciencia es simplemente el nombre que le damos a nuestros errores!!!