|
|
View previous topic :: View next topic |
Author |
Message |
shalts
Joined: 20 Oct 2006 Posts: 17 Location: Ankara
|
DMX, couldn't get FERR, couldn't run INT_RDA |
Posted: Sun Mar 28, 2010 3:56 pm |
|
|
Dear Friends,
What I am trying to do is to make a start for DMX512.
I prepared an RS232 to RS485 converter board to let my computer be able to send me data @115000 BAUD, 8-N-2, when I press to keyboard from HyperTerminal.
Also I have a demo board with a PIC16F873 with 20Mhz xtal, and with a 2x8LCD, and an LED. When I use the codes (while both hyperterminal and PIC with same baud rates):
Code: |
#use rs232(baud=115200, xmit=pin_c3, rcv=PIN_C7, enable=PIN_c5, STOP=2)
int a;
while()
{a=getc();
clr_disp(); //clears display before any write
lcd_gotoxy(1,2);
printf(lcd_putc,"A=%u",a);}
|
I can see the values of each pressed key from the keyboard. This part works.
But when I changed only the baud rate of hyperterminal to 1200 to test if I can get the framing error from FERR, it doesn't work. Neither does INT_RDA(@same baud rates). Its been 2 days I couldn't find why. My code is as follows (without LCD part):
Code: |
#include <16F873.h>
#device adc=8
#use delay(clock=20000000)
#fuses hs,nowdt,noPROTECT,NOBROWNOUT
#use rs232(baud=115200, xmit=pin_c3, rcv=PIN_C7, enable=PIN_c5, STOP=2) //
#byte RCSTA = 0x18
#byte RCREG = 0x1A
#byte PIR1 = 0x0C
#bit FERR = RCSTA.2
#bit RCIF = PIR1.5
#define led pin_b0
int a;
void main()
{
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
output_high(led);
delay_ms(500);
output_low(led);
while(1)
{
if(FERR==1)
{
output_high(led);
delay_ms(1000);
output_low(led);
delay_ms(1000);
a=getc();
}
}
}
#INT_RDA
receiver()
{
output_high(led);
delay_ms(50);
output_low(led);
delay_ms(50);
a=getc();
}
|
I would appreciate any help about how to get a FERR and how to make the RDA work please.
Regards,
Shalt _________________ Murat Shalt Unal |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Mar 28, 2010 10:50 pm |
|
|
Quote: |
#include <16F873.h>
#use rs232(baud=115200, xmit=pin_c3, rcv=PIN_C7, enable=PIN_c5, STOP=2)
|
You're using a software UART. To use the hardware UART, you must
specify pins C6 and C7. Any other pins will give you a software UART.
The hardware FERR bit is only valid if you use the hardware UART. |
|
|
shalts
Joined: 20 Oct 2006 Posts: 17 Location: Ankara
|
|
Posted: Mon Mar 29, 2010 7:38 am |
|
|
Dear PCM Programmer ,
Thank you very much for your reply. You helped me a lot. I solved the problem . Can get FERR, OERR now. I runned a simple DMX receiver also.
Best Regards,
Shalt _________________ Murat Shalt Unal |
|
|
spradecom.rnd
Joined: 27 Apr 2010 Posts: 16 Location: Mumbai
|
|
Posted: Thu Aug 05, 2010 4:38 am |
|
|
Can any one send me working DMX receiver code. I am using PIC16F1938. I have tried several routine but no use. email spradecom.rnd@gmail.com |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|