Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About mchristisen

  • Rank

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Gender
  • Location
  1. check out Mid-Range Referance Manual page 155 for description of Read-Modify-Write. and this manual page 4 for LAT description.
  2. thanks for the great suggestion Reynard! Will use four 74AC257's and multiplex into a single port. I can also move to a lower pin count pic. Thanks again, mchristisen
  3. New guy question here. I am attaching multiple 4 bit counters to a 16F946. The pic reads the value of the counters 4 bit output. As I use up the I/O pins I am having trouble connecting the 4 bit output to sequential port inputs due to peripheral usage. So, some counters fit nicely as the lower or upper four bits of a port. While others are spread out amongst multiple ports. Is there an easy way to combine several different pins from several different ports into one variable? I am thinking something like: char CounterX = ((porta.n << 3) | (porte.n << 2) | (portb.n <&l
  4. you want to be in and out of your ISR as fast as you can. So once in the ISR, clear the interrupt and set a flag that your main can respond to. Looks like you are doing way to much in your interrupt routine.
  5. The FIFO lines may be pulled high when not enumerated giving you 255. Check FTDI documentation for config setting to pull lines low when the FTDI chip is in reset. There isnt really anything on your PIC that is USB related. The FTDI is taking care of all things USB. Every time you disconnect and reconnect your module the FTDI chip is busy talking to the host whether your PIC knows it or not. If future projects make this approach less than ideal consider monitoring the unused 5V from the USB port for connection status (assuming your module is self powered). Only read FIFO whe
  6. If you are using a virtual com port, make sure that the port is closed before disconnecting your device. You may be enumerating as a different com port if the previous port is still open. Also, if you connect to a different USB port it may enumerate as a different com port. the host can reset your device at anytime. It does not have to be disconnected and reconnected to enumerate, although that will obviously force a reset. In fact, anytime you plug a USB device into a Windows machine it will enumerate twice.
  7. disregard previous post. my problem is different, delay routines work at 10MHz but do not work with HS PLL enabled for 40MHz.
  8. I am also having this problem. For 18F4431 with 10MHz crystal (w/ HS PLL for 40MHz). -delay_ms(500) works as expected at 10MHz or 40MHz. -delay_s(1) does not work. Is very erratic at 10MHz and seems extremely long at 40MHz. I am changing the #pragma CLOCK_FREQ appropriately and I see no delay overhead, unit delay or delay resolution values during the linking process. Did you find a solution to this problem DavidT?
  9. I am new to C & PIC's myself and am not qualified to answer anything with any authority but if I understand your question correctly this may help. You can write you own Print function that is hardware specific for your needs. I used the following to send text via a hardware serial port on a 16F887. void PRINT(char str_Text[]) { j=0; while(str_Text[j] != 0) { txreg = str_Text[j]; // Load serial out register with data j++; while(!pir1.4); // Wait until serial out register is clear } } void main(void) { while(1) { if (some criteria) PRINT("Hell
  10. Forget about shorting the two pins of the switch together. You have the right idea using a sigle I/O. Next step is to pull out your meter and figure out how the camera knows you pressed the switch. You also need to follow the traces on the board to figure out what side of the switch you will be connecting your PIC I/O. If the switch supplies GND, have your pic do the same and tie your I/O directly to the buisness end of the switch. If it supplies a positive voltage you may need to take some extra steps. If the switch voltage is higher than your PIC's supply voltage you may be able
  11. void PRINT(char string[]) { j=0; while(string[j] != 0) { txreg = string[j]; j++; while(!pir1.4); } } void main(void) { while(1) { if (some criteria) PRINT("Hello Everybody"); } } The code above is what originally confused me and got me wondering about how strings are stored. I did not understand how the PRINT function worked. I was under the impression that "char string[]" only allowed for 8 bits total to be allocated for string[]. But emte's post straightened me out that 8 bits for each index of string[] were allocated. Or if I wished, I could define the varia
  12. Oh Ok, each individual character is kept as an "unsigned char". Makes perfect sense.... thanks emte
  13. I am looking for information on how a string is actually stored. Say x = "ABC", how will this be laid out in bits. Will each character take up seven bits sequentially followed by the null? x = "ABC" same as x = 1000001100001010000110000000 thanks, Matt
  14. 16F877A has no internal oscillator and requires an external RC oscillator, Resonator or Crystal to operate at speeds up to 20MHz. You should be fine with your 20Mhz crystal.
  • Create New...