Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Hobknob

  • Rank
  1. It is correct, but you must also enable the global interrupt enable enable_interrupt (INTE); // enable the external interrupt enable_interrupt (GIE); // turn interrupts on Regards Dave
  2. The RA4 pin has a different output circuit to the other pins on port A. The other pins have a sink/source capability, while RA4 can only sink current. To turn you led on on RA4, connect it between 5V and the pin, then set the pin output to 0 to turn the LED on, and 1 to turn the LED off. Regards Dave
  3. You can tell that the processor has been watchdog reset by checking bit 4 (TO bit) in the STATUS register. If the processor has been watchdog reset this bit is 0. I guess you are talking about using timer TMR0, for you interrupt driven serial comms. One bit being transmitted every interrupt. The limitation with TMR0 and watchdog, is that they have only one prescaler between them. It can be switched to be used either by TMR0 or watchdog, but not both at the same time. The watchdog will still work if TMR0 is using the prescaler, but has a much shorter timeout period. Hope this help
  4. The simulator currently simulates: Instruction decoding, ALU, W REG, STATUS register, Program counter, FSR register, RAM File Registers, Stack, TMR0 and EEPROM. Interrupt generation from port b is not currently supported, but will be implemented very soon. Regards Dave
  5. The simulator currently simulates: Instruction decoding, ALU, W REG, STATUS register, Program counter, FSR register, RAM File Registers, Stack, TMR0 and EEPROM. So you will see no activity from timer 2 in the simulator. Regards Dave
  6. What is the status of the watchdog, if the watchdog keeps reseting the processor before the timedelay complete, the LED's will never go off because the code will never get that far. Try disabling the watchdog. Regards Dave
  7. The delay_x functions work by creating a software delay loop. Consider how long the pulse will be with the LED's off - it will be about 4 microseconds with a repetition rate of 1000,000 microseconds (1 second), so you are looking for something that will be hard to trigger on with your scope. Please try the modified code, I sure it will resolve your problem. Regards Dave
  8. The problem is you have a delay after switching on your LED's, but not after you switch them off. This means that are off for such a short time you won't see it. I've added an additional delay in the code below to make it work. //Timing settings #pragma CLOCK_FREQ 4000000 void main(void) { //Hardware Initialization disable_interrupt( GIE ); set_bit( STATUS, RP0 ); set_tris_a( 2 ); set_tris_b( 0 ); clear_bit( STATUS, RP0 ); output_port_a( 0 ); output_port_b( 0 ); while(1) { output_port_b(0xff); delay_s(1); // delay to kee
  9. Becareful. The circuit you are talking about will almost certaininly not being meeting the RS232 specification, although it may work on one PC. The RS232 spec requires a minimum of +/-3V at the receiver, so if you want your PC to receive data from you PIC you need to provide voltages at least around these levels. If you just want your pic to recieve data from you PC, then a couple of resistors and clamping diodes should work pretty well, but the interace does not meet the RS232 spec. Something like a max232 does a nice solution to providing at interface that meets the RS232 spec.
  10. Consider performing more testing using putch(); eg while( 1 ) { for ( int i = 65; i < 82; i++ ) putch( i ); } Make sure that you get a to z, just testing with single character could work with some port parameters wrong. Regards Dave
  11. I think the rules for posting maybe unclear. At first a questioned is asked as particular behaviour may be a bug or just a users miss-understanding. I would be confused by this. Regards Dave Hobknob
  12. How does one know if a problem is a bug, or a characteristic, or a mis-understanding of how to use the tool? Regards Hobknob
  13. Please be more specific as to what the issues you beleive to exist. Regards Hobknob
  14. Whoops I meant #pragma TRUE_RS232 1 to #pragma TRUE_RS232 0
  15. What components are being used in the electrical interface to your PC ? - Some kind of voltage level convertor is required. Sometimes this kind of interface circuit invertors the signal, sometimes it does not. Consider the RS232 polarity - change #pragma TRUE_RS232 1 to #pragma TRUE_RS232 2 to reverse.
  • Create New...