Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Cerf

  • Rank
  1. Hey, I'm just doing some reading on the I2C communication protocol, and I was wondering: how are addresses assigned to slaves? Is the address assigned when the physical circuit is being created and pins are connected to HIGH or LOW depending on what the designer wants?
  2. I figured out what I have to do if (kbhit()) { c = getc(); porta.2 = c.0; delay_ms( 1000 ); putc(c); } It was blinking so fast that I couldn't see the change in the LED, thats why I added a delay
  3. What about reacting to input I tried the following, but no character are echoed in hyperterminal when the following is run: char c; if (kbhit()) { c = getc(); porta.2 = c.0; putc(c); }
  4. When I read your comment, I started thinking. I wasn't keeping very clean code, so I started to clean it up. When I was done (well sort of done) I recompiled and tested it, and now it works! My problem was that I had all the #define's, #include's, and #pragma's in the wrong order. The only qualm I have with the code is that if I were to type three or four letters in the terminal quickly, the pic responds slowly. Does anyone know how I can speed up the response of the pic? If I want a faster response time will I have to use an interrupt based system? Thanks -Derek Here
  5. whenever I use the kbhit() and getc() functions, the putc() function stops working. But the LED flashing still works putc( 'T' ); putc( 'e' ); putc( 's' ); putc( 't' ); putc( '\r' ); putc( '\n' ); //Flash PortA.2 LED in endless loop while( 1 ) { porta.2 = 1; // turn off LED delay_ms( 250 ); porta.2 = 0; // turn on LED delay_ms( 250 ); if (kbhit()) { putc(getc()); } }
  6. It works! What do I need to do to read information off of the serial port? From what I understand, I will have to impliment an interrupt handler because when a charater is recieved, an interrupt is generated. From there the character is read and the interrupt reset so that the USART and read another character?
  7. Hey, I got rs232 communication working on my pic, and I am seeing information in hyperterm, but it is jibberish. Does any one know what setting I have to use? From what I read, rs232_driver.h uses only 1 stop bit, and my code is configured to use 9600 bpd, but what is the data bit length, and the parity? I am assuming that the flow control is "None" #include <system.h> // target PIC16F628 //Configuration Bits #pragma DATA _CONFIG, _CP_OFF & _PWRTE_OFF & _BODEN_OFF & _WDT_OFF & _LVP_ON & _MCLRE_OFF & _HS_OSC #define spBAUD 9600 #define FOSC 20
  8. IT WORKS! ITS ALIVE! ITS ALIVE! well sort of, but before I get into the small problem I have, I will present the code #include <system.h> #pragma DATA _CONFIG, _CP_OFF & _PWRTE_OFF & _BODEN_OFF & _WDT_OFF & _LVP_ON & _MCLRE_OFF & _HS_OSC //20 MHz quartz #pragma CLOCK_FREQ 20000000 void main() { //Hardware Initialization cmcon = 7; vrcon = 0; trisa = 0; trisb = 0; porta = 0; portb = 0; while( 1 ) { porta.2 = 1; // turn off LED delay_ms( 250 ); porta.2 = 0; // turn on LED delay_ms( 250 ); } }
  9. I tried to replicate you problem in the SourceBoost IDE using the BoostC toolsuit with the following unsigned short h = 1000; unsigned short j = 1000; unsigned short k; k = h/j; The problem appears to be either a limitation of your tool suit or a problem with your target. In both cases it is most probably because your setup cannot handle the division of 16 bit values. If it is a limitation of the toolsuite you could always write an algorithm that divides two 16 bit numbers but I don't know how one would do such a thing, changing your tool suite would probably be easier. If the tar
  10. I emailed Olimex and I asked them if they could send me a test hex file that would make the LED blink. They were kind enough to provide the hex file and the corresponding c code for me that tested the LED and the RS232 functionality (I'm not going to post it because I dont yet know if I have permission). But when I loaded it onto the PIC I observed no functionality. No blinking LED. This lends me to believe that there is a problem with my hardware. I am going to break out the multimeter later today to test what I can on the board, but the one thing I dont know how to test is the extern
  11. it compiled,but it did not work I was wondering, the power supply I am using is 9VDC and 300 mA. Could a zenner diode be cutting off power to the pic?
  12. I got the programmer working now, thanks for the advice
  13. Hey, I've been having problems having my pic communicating with my computer over rs232, although my code compiles and loads, it doesn't work. So I decided to do something simpler; I want to make LED blink I've written some code that, when an LED is connected to RB1 and RB2 the LED should blink. Not too difficult right? The LED should blink at a rate of .5 Hz, on for 1 second, off for one second. Well, when I connect the LED to pin 1 and 2 of port b, the LED doesn't blink. In fact the LED doesnt turn on at all. I really don't know whats wrong. I suspect its a hardware p
  14. I found some code written by doozer http://sourceboost.ipbhost.com/index.php?a...ite=txreg_putch that is compiling, I need to test it now, but I can't seem to get my programmer working. I'm using IC-Prof 1.05D. The device is the PIC 16F628, the Oscillator is HS, Code protect is off, the fuses are wdt pwrt mclr boden lvp cpd. The programmer is the PIC-PG4 as referenced above. When I run Program All the error I get is always "Programming failed at Code address 000h !" Does anyone know whats going on here? ///////////////////////////////////////////////////////////// // This tes
  15. Everything is working now except for the putchar function Is this function defined in any standard library (ie. do I have to #include <stdio.h>)?
  • Create New...