serial Rf module

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
wati
Posts: 4
Joined: Fri Nov 24, 2006 10:28 am
Location: MALAYSIA
Contact:

serial Rf module

Post by wati »

good aftrnoon,

I am not good in Microncontroller nor programmg. Only basic.
wish anybody could tell me how to send data in serial from RF module ( transmit and receive) to pic ( 16f877)using c language or any example of flowcode. i have read from the forum about SPI and confuse whether to use master sync port ( MSSP ) or USART for this purpose since i have seen from others using USART for this purpose. Again pleasss help me. :cry:

TQ
WATI

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Post by Benj »

Hi Wati

What is the serial / product code fo the RF module. Maybe there will be a datasheet informing exactly how to interface it.

If other people are using the UART then you will probably need to use this also. However you will need to find out if the communictaion method is synchronous or asynchronous (clocked half-duplex / full-duplex).

In the Pic datasheet there is a list of exactly how to program the UART in both synchronous or asynchronous mode.

wati
Posts: 4
Joined: Fri Nov 24, 2006 10:28 am
Location: MALAYSIA
Contact:

rf control

Post by wati »

thank for the concern of replying,

I am using 433 MHz rf ( transmitter and receiver )at this moment. I am attendint to use tranceiver ( laipac 2.4 Ghz - not buy yet ) for dual communication. I don't know the serial number ( when i bought it small size with no serial number ). I think it usart ( ascynronous serial comm ). I have 2.1 flowcode but it doesn,t have the asyncr serial block. some example using basic which i get from internet( retron) at below web . the program look simple in basic

http://www.rentron.com/ruf-bot.htm
WATI

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Post by Benj »

I have seen this project before and your right the code does look easy. If you use the RS232 component in flowcode then this will utilize the UART pins.

I would however suggest these modules

http://www.maplin.co.uk/Module.aspx?Mod ... &doy=28m11

and these encoder chips

http://www.maplin.co.uk/Module.aspx?Mod ... &doy=28m11

I suggest these ones because they do not need the RS232 serial communication. They are basically an easy way to get 4 digital I/O lines straight to the reciever module. All of the multiplexing is taken care of for you and the devices are encrypted to limit the possibility of data loss / corruption.

wati
Posts: 4
Joined: Fri Nov 24, 2006 10:28 am
Location: MALAYSIA
Contact:

rf remote

Post by wati »

U are definately right benj, i have tried use RF encoder before and it's working but i wish to try and learn using serial communcation. I have choose, pick and alter some of the program in c2c( i am also use c2c compiler ) website wher i wish to send and receive binary / data for rf ( were 2 micocontroller involve, one at the transmitter and another one at the receiver )but i don't know whether its working or not. Pls comments. TQ


//transmit
#pragma CLOCK_FREQ 3276800

// Port addresses
char PORTC@0x07;

// USART Registers
char TXREG@0x19;
char RCREG@0x1a;
char TXSTA@0x98;
char RCSTA@0x18;
char SPBRG@0x99;

void main()
{
set_bit( STATUS, RP0 ); // *** Register page 0 ***
clear_bit( TXSTA, SYNC ); // Asyncronous mode;
clear_bit( TXSTA, BRGH ); // RRGH = 1 ( High speed mode )
SPBRG = 22; // SPBRG = 22 ( Set Baud rate 9,600 )
clear_bit( STATUS, RP0 ); //
set_bit( RCSTA, SPEN ); // Enable Serial port
clear_bit( STATUS, RP0 ); // Asyncronous mode;
clear_bit( TXSTA, TX9 ); // 8 bit transmit mod
set_bit( TXSTA, TXEN ); // Enable Transmitter
clear_bit( STATUS, RP0 ); //

TXREG=0;
{
WHILE(1)
((_TXSTA &_TMRT)!=1));
TXREG = 2; // data 0000 0010 send
DELAY(400);
}
}

//receive
#pragma CLOCK_FREQ 3276800

// Port addresses
char PORTC@0x07;

// USART Registers
char TXREG@0x19;
char RCREG@0x1a;
char TXSTA@0x98;
char RCSTA@0x18;
char SPBRG@0x99;



void main()
{

set_bit( STATUS, RP0 ); //
clear_bit( TXSTA, SYNC ); // Asyncronous mode;
clear_bit( TXSTA, BRGH ); // RRGH = 1 ( High speed mode )
SPBRG = 22; // SPBRG = 22 ( Set Baud rate 9,600 )
set_bit( RCSTA, SPEN ); // Enable Serial port
clear_bit( STATUS, RP0 ); // Asyncronous mode;
clear_bit( TXSTA, RX9 ); // 8 bit transmit mod


WHILE(1)

((_PIR1&_RXIF)!=0));
IF (RCREG == 2)
{
set_bit(STATUS,RPO);
TRISA=0X00 ;
clear_bit(STATUS,RPO);
PORTA = 1; // to turn on bit 0 at port A
delay_s(2);
}
mainendloop :goto mainedloop;

}
WATI

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

Re: serial Rf module

Post by Genilsonsa »

Ola estou aproveitando este topico para tirar uma dúvida.Eu preciso decodificar controle remoto tx HT6P20B utilizando o pic 16f628a.Esse controle é o mesmo que usam em PORTÃO AUTOMATICO e ALARMES residencial.Gostaria de saber como implementar isso no FLOWCODE

All4U
Posts: 2
Joined: Tue Nov 29, 2011 4:56 pm
Contact:

Re:

Post by All4U »

Benj wrote:Hi Wati

What is the serial / product code fo the RF module. Maybe there will be a datasheet informing exactly how to interface it.

If other people are using the UART then you will probably need to use this also. However you will need to find out if the communictaion method is synchronous or asynchronous (clocked half-duplex / full-duplex).

In the Pic datasheet there is a list of exactly how to program the UART in both synchronous or asynchronous mode.
Hi Benj,

I intend to use this DRF7020D27 module (from here: http://www.dorji.com/pro/RF-module/High ... eiver.html) for my wireless data collection which is one master and two slaves, controller used is PIC16F877A. The idea is using polling method.. I do not experience on programing...could you give me some advise?

Thanks in front!

organetic
Posts: 7
Joined: Tue Jul 29, 2014 6:45 pm
Has thanked: 1 time
Contact:

Re: Wireless IO lines

Post by organetic »

Dear Benji,

Sorry for asking for helping on such an old thread, but I would really like to know exactly how we should implement this kind of solution in Flowmotion?

It would be great if I could get 4 wireless IO lines, but It would help to see some sample coding, if possible.

Cheers and thank you for your help!


Benj wrote:I have seen this project before and your right the code does look easy. If you use the RS232 component in flowcode then this will utilize the UART pins.

I would however suggest these modules

http://www.maplin.co.uk/Module.aspx?Mod ... &doy=28m11

and these encoder chips

http://www.maplin.co.uk/Module.aspx?Mod ... &doy=28m11

I suggest these ones because they do not need the RS232 serial communication. They are basically an easy way to get 4 digital I/O lines straight to the reciever module. All of the multiplexing is taken care of for you and the devices are encrypted to limit the possibility of data loss / corruption.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: serial Rf module

Post by Benj »

Hello,

I assume you mean Flowcode as FlowMotion is according to Google a "Organic Personal Lubricant" or sequencer software.

Assuming your using the encoders you simply need to use an input icon to read the incoming values and an output icon to set the outgoing values.

The logic level on the pin to the encoder will be transmitted before being received and output on the decoder.

Post Reply