Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing PIC16F877A and TWS 434/ RWS 434

Status
Not open for further replies.

SAWULA

Newbie level 6
Joined
Nov 11, 2009
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,378
I want to send some data from a transmitter and display them on a LCD. My problem is can I connect TWS 434/RWS 434 to the usart of the pic without max232, Or do I need to use Max232 ? And can I use UART1_Write_text() mikroc command to send data from the transmitter ?
Thank You!
 

Hello,

As you can see in the datasheet:

Vh Input High Voltage Idata = 100uA (High) Vcc-0.5 Vcc Vcc+0.5 V
Vl Input Low Voltage Idata = 0 uA (Low) - - 0.3 V

If you power the chip and PIC at 5v there is no problem.
 

can I connect TWS 434/RWS 434 to the usart of the pic without max232, Or do I need to use Max232 ?
direct connection will work fine, have a look at this example:
**broken link removed**

:wink:
IanP
 

direct connection will work fine, have a look at this example:
**broken link removed**

:wink:
IanP

I read your link and it uses pic basic pro serout command (serout 1,n9600,(B0)) with PIC16F84 pic. But PIC16F84 does not have a UART. I am using PIC16F877A with a UART and mikroc compiler. can I know how to convert serout command to Mikorc. Please help me.
 

If you must use a PIC16F84, you'll need to implement what is referred to as a softUART.

I believe MikroC has a softUART in its function library.

BigDog

---------- Post added at 16:33 ---------- Previous post was at 16:25 ----------

Reference MikroC Software UART Library:
Software UART Library
The mikroC PRO for PIC provides routines for implementing Software UART communication. These routines are hardware independent and can be used with any MCU.
The Software UART Library provides easy communication with other devices via the RS232 protocol.

Important : The Software UART library implements time-based activities, so interrupts need to be disabled when using it.

Library Routines
Soft_UART_Init
Soft_UART_Read
Soft_UART_Write
Soft_UART_Break

MikroC Software UART Code Example:

Code:
char i, error, byte_read;                 // Auxiliary variables

void main(){

  ANSEL  = 0;                             // Configure AN pins as digital I/O
  ANSELH = 0;
  
  TRISB = 0x00;                           // Set PORTB as output (error signalization)
  PORTB = 0;                              // No error

  error = Soft_UART_Init(&PORTC, 7, 6, 14400, 0); // Initialize Soft UART at 14400 bps
  if (error > 0) {
    PORTB = error;                        // Signalize Init error
    while(1) ;                            // Stop program
  }
  Delay_ms(100);

  for (i = 'z'; i >= 'A'; i--) {          // Send bytes from 'z' downto 'A'
    Soft_UART_Write(i);
    Delay_ms(100);
  }
   
  while(1) {                              // Endless loop
    byte_read = Soft_UART_Read(&error);   // Read byte, then test error flag
    if (error)                            // If error was detected
      PORTB = error;                      //   signal it on PORTB
    else
      Soft_UART_Write(byte_read);         // If error was not detected, return byte read
    }      
}

The above example should get you started in the right direction.

BigDog
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top