Jump to content

Danny Higgins

  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Danny Higgins

  • Rank
  1. this chip requires a 1Tcy between the port read and interrupt clear. Try an nop(); in there. As the key is human operated you could try polling every couple of ms. Cheers Reynard Many thanks Reynard. I tried removing the last return, but no change. I tried putting a NOP after reading portb but no change. Finally I tried your suggestion of reading portb only once into B_Current and it seems to be working. I doubt if I would have thought of that as a solution to the problem. Polling the morse key and PTT lines would have been a last resort as some morse dots are on
  2. Thanks Reynard. The key is an electronic one with logic gates driving an open collector transistor with 1nF across the contacts, so there should be no bounce. I've also tried setting a flag as soon as an interrupt occurs and I checked this flag to make sure that interrupts are not re-occurring before the first one finishes. The code in the interrupt routine has been kept short to prevent this also. I will try your other suggestion on Sunday when I get back home and I'll let you know the result. Danny
  3. I am building a PIC controller to control a transmitter. I have connected a morse key to RB4 with a 15kOhm pull up and I am trying to detect changes using interrupts on PORTB. The PIC is an 18F4525 running at 16.384 MHz. The PIC always seems to detect the morse key going down and switches on an LED, but about 5% of the time (apparently randomly) the LED is not switched off when the morse key is released. It starts to work again the next time the key is pressed. I have tried to detect switch bounce, but there does not seem to be any interrups occurring during the interrupt routine. I have
  4. Many thanks Ian. You have explained it extremely well. You can stop cringing now - I'm about to change all my "portx.y = 1" lines of code. Danny
  5. Thanks mchristisen and Reynard. I am writing to some port bits and reading from others, not mixing read and write on the same pin. Writing to one pin was OK, but when I wrote to another pin it reset the first pin, so I'm not quite sure what is happening. I will investigare further. Danny, G3XVR
  6. What is the recommended way of setting/clearing a single output line? Is there any difference between: PORTC.1 = 1; LATC.1 = 1; set_bit(PORTC, 1); set_bit(LATC, 1); Should individual output bits be declared as volatile? What is meant by a Read - Modify - Write operation in the PIC datasheets? Thanks, Danny, G3XVR
  7. I think I've found the problem. Interrupts were not happening (no void interrupt(void) routine)! Thanks, Danny
  8. Hi trossin. Thanks for the reply. The transmit buffer is 40 characters long and I don't send new messages until there is less than 5 characters in the txBuffer waiting to be sent. The maximum message length is only about 20 characters long, so the txBuffer does not overflow. I am testing it at the moment by sending a short string to an empty buffer and putting a breakpoint in MPLAB after the message has been sent. All of the message goes into the txBuffer but it is not all sent, depending on the delay I put in. 1ms delay is about the length of time it takes to send each character at 9
  9. I have a problem sending ASCII characters via my hardware UART routine. I am using an 18F4525 at 16.384MHz sending 7 bit ASCII with EVEN parity at 9600 Baud. I need to put a delay in the putChar routine to get it to work. With no delay only a NULL is sent. With 250uS delay only the first few characters are sent and with a 1mS delay all the characters are sent. Can someone tell me why I need the delay? The sendString routine puts all of the characters into txBuffer but they are not all sent. If I stop after sending a truncated string, the txIn pointer is correct, but the txOut pointer
  10. Hi Pavel. I would like to see more info on PIC to PIC communications using I2C. I have designed a board to give me extra serial ports and I/O lines using a master and 2 PIC slaves, but I haven't got that part of the code working yet. Thanks, Danny
  11. Hi Rye. I keep getting my reply to your e-mail bounced. Here it is: Hi Rye. I haven't made any progress since June. This project has quite a few areas that need attention and I'm afraid that the I2C problem has been put to the back of the queue. I have finished the PIC processor board and 90% of the software is now running. The RF board is now complete and tested and so is the multi-port I/O board. I am just finishing the audio section this weekend. The next job will be the metalwork. I2C is a longer term goal to give me 2 additional hardware serial ports and a fe
  12. Thanks Ettore. I've found various bits of code I can patch together to hopefully do what I need. Searching has also shown that there is an error in AN734 for Slave operation. Danny
  13. I have a board with 3 PICs, a master 18F4525 and 2 slave 16F876s, connected on the I2C bus. I wish to use the hardware UARTs on the slave PICs as additional serial ports (as well as additional I/O) using BoostC 6.70. I cannot search the archives for "I2C" (too few letters) and all of the examples I've found deal with reading/writing to an external EPROM. Can I get the master PIC to directly access the RAM locations in the slave PICs? Any help or pointers to example code would be most welcome as this is the last (I hope!) major function to be implemented in this long running project.
  14. The Hitachi display has 80 bytes of RAM. They are all accessible even if you don't have an 80 character display. You could try writing to / reading from one of the unused bytes to see if the display is there. Even if all 80 bytes are used you should be able to read a byte, change it, read it back again then set it back to its original value without noticing anything on the display. Danny
  15. Thanks Dave. I had just found that out. I knew I had added it before when I set up MPLAB with BoostC, but didn't realise I had to add it to every new project. Thanks, Danny
  • Create New...