CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

DMX, couldn't get FERR, couldn't run INT_RDA

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
shalts



Joined: 20 Oct 2006
Posts: 17
Location: Ankara

View user's profile Send private message Send e-mail

DMX, couldn't get FERR, couldn't run INT_RDA
PostPosted: Sun Mar 28, 2010 3:56 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Mar 28, 2010 10:50 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Mon Mar 29, 2010 7:38 am     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Aug 05, 2010 4:38 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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