Jump to content

Turhan

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Turhan

  • Rank
    Newbrie
  1. Hi, who can tell me, why the following code for 16F876A does not work? //--------------------------------------------------------------- // Test programm for simple output via USART (polling) //--------------------------------------------------------------- #include <system.h> // #define SOFTWAREEMULATEDSUPPORT // #include "my_rs232_driver.h" // #include <rs232_driver.h> #pragma CLOCK_FREQ 8000000 //Writes Character to Serial Port void OutTx(unsigned char cByte) { while(!pir1.TXIF) // pie1.TXIE Wait for interrupts to finish last message continue; txreg = cByte; } void main(void) { char cLoop = 0; adcon1 = 0x06; // set all pins as digital inputs trisc = 0x80; // Rx In portc = 0x00; spbrg = 51; // 2400 Baud @ 8 MHz txsta.BRGH = 0; txsta.SYNC = 0; rcsta.SPEN = 1; // Serial Port Enable ... RC6 for Tx and RC7 for RX pie1.TXIE = 0; // Polling ... No Interrupt Enable txsta.TXEN = 1; // Transmission Enable while(1) { cLoop++; // putc(cLoop); OutTx(cLoop); delay_ms(1); } } Thanks Turhan
  2. Dave, I can not use inline assembly code and can not use rs232-functions! If I want to compile the code void setup(void) { asm { banksel trisc movlw b'01000000' movwf trisc } } I get the following error Have you got an idea why inline assembly code and the rs232-functions described in "serial_driver.h" do not work in both versions IDE 6.33 and 6.35 I installed ? Regards Turhan
  3. Thanks for the help Dave, Since it wasn't a code error I updated the compiler to version 6.33 and now it works Tone <{POST_SNAPBACK}> Dave, do you have an idea, why the given code does not work with version 6.33 for 16F876A? What´s about the headerfile "rs232_driver.h"? The needed definitions and variables are in the file "SimpleSend.h". What can be the reason for this problem ? Regards Turhan #include <system.h> #include "SimpleSend.h" // char txreg; void sendString(const char * string); void sendString(const char* string) { char i; for (i = 0;i < 3; i++) { while((txsta & 1 <<TRMT) ==0) portb.0 ^= 1; txreg = string[i]; } } void main() { trisb = 0; while(1) { sendString ("ABC\x0D\x0A"); } }
×
×
  • Create New...