Discussion in "PIC Microcontroller Discussion" started by    Zacky    Mar 23, 2009.
Mon Mar 23 2009, 05:56 pm
#11
which chip u r using.....how u interface pic and pc serially and what data u want to transfer from pic to pc
Mon Mar 23 2009, 06:20 pm
#12
I'm using PIC16F877A chip. Using RF module which I bought from Cytron.com.
Mon Mar 23 2009, 07:36 pm
#13
i tried visitng that website but it redirected me here http://www.golddealer.ca/ :-s

can you provide datasheet or part number? that will be simpler i guess.
Mon Mar 23 2009, 08:54 pm
#14
The website www.cytron.com.my. Anyway, here's the datasheet.
Mon Mar 23 2009, 10:41 pm
#15
I'm intending to make the PIC and the PC to communicate via RF module. This is the first testing using RF transmission from PIC to PC. Later I will have to test RF transmission from PC to PIC. I tried searching through the supplier's website (www.cytron.com.my) and bought their PR16 project to use as reference. The project was working fine. Examination at the source code (which can be downloaded from their website www.cytron.com.my), I noticed that they stop the reception on buffer overrun error. Is it possible to do it in VB6? I've attached the PR16 source code and schematic as well as description.
Attachment
Mon Mar 23 2009, 11:09 pm
#16
I'm using 16F877A, MAX232, 433MHZ TX & RX
Tue Mar 24 2009, 05:00 pm
#17
how much baud rate are you keeping? max rate for these rf modules is 4.8K. so keep baud under 4.8K It is recommended to use 1200 baud for successful data transmission.
Tue Mar 24 2009, 09:02 pm
#18
I tried using 1200 as baud rate, but the mikroBasic compiler does not allow this rate as it shows compile error. I used 2400 but still getting the same error. All I'm trying to send is a single character back to the pc. Anyway, here's the mikroBasic code:

*Note: The LCD is connected on PORTB as shown in mikroBasic Manual. The code works well for a wired connection.

program LCDTryout

dim text as string[16]
dim txt as string[3]
dim i as byte
dim j as byte
dim stat as byte
main:
TRISA = $00 ' Comfigure PortA as output
TRISE = $FF ' Configure PortE as input
TRISB = $00 ' Configure PortB as output

text = "Welcome"
LCD_Init(PORTB)
LCD_Cmd(LCD_CLEAR) ' Clear display
LCD_Cmd(LCD_CURSOR_OFF) ' Turn cursor off
LCD_Out(1,1, text) ' Print text to LCD, 1st row, 1st column
USART_init(2400) ' initialize USART module (8 bit, 2.4K br, np )


while TRUE
if (USART_Data_Ready()) then ' if data is received
i = USART_Read() ' read the received data
ByteToStr(i,txt) ' Convert the data into string to print
LCD_Out(2,1,txt) ' on LCD

j = i + 2 ' Displace the received data by 2
USART_Write(j) ' Transmit the displaced data
ByteToStr(j,txt) ' Convert the data into string to print
LCD_Out(2,6,txt) ' on LCD
end if
wend
end.
Tue Mar 24 2009, 09:47 pm
#19
I found out the reason why the mikroBasic produced the compiler error, it was not possible to produce baud rate of 1200 at 20Mhz. I changed to 4Mhz and can compile, but still experiencing the same problem with the RF transmission. Haih..... :mad
Wed Mar 25 2009, 04:15 am
#20
Changed several RF modules, still not able to transmit the required data over to PC. So, its sure not the module problem. The transmission is working fine when tested with a wired connection. So, the initialization of USART is ok. Checked the pin connections many times, the connections are correct. Changed the baud rate to be 1200 as suggested by Ajay, still no change. What am I missing?

Hmmm....Maybe I should do some filtering code in VB6 and test with my custom software instead of the "Connection Terminal" in MikroBasic. Its been weeks since I had proper sleep.

Hopefully, I can get some help and solve this problem within this week as I have to submit the project in a week time. Thanx in advance for those who wants to help. :-)

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

RodneyKnorb
Thu Apr 25 2024, 07:08 pm
Williamjef
Thu Apr 25 2024, 02:08 pm
SamuelSmise
Thu Apr 25 2024, 09:56 am
DustinErele
Thu Apr 25 2024, 08:44 am
ztaletpzca
Wed Apr 24 2024, 11:19 pm
IrardlPex
Wed Apr 24 2024, 08:42 pm
Charlestehed
Wed Apr 24 2024, 05:20 pm
Robertgurse
Wed Apr 24 2024, 02:43 pm