Jump to content

mchristisen

EstablishedMember
  • Content Count

    26
  • Joined

  • Last visited

Community Reputation

0 Neutral

About mchristisen

  • Rank
    Regular

Contact Methods

  • Website URL
    http://www.thechristisens.com
  • ICQ
    0

Profile Information

  • Gender
    Male
  • Location
    Austin
  1. is libc.pic16.lib added to your project?
  2. mchristisen

    Portc.1 Or Latc.1

    check out Mid-Range Referance Manual page 155 for description of Read-Modify-Write. and this manual page 4 for LAT description.
  3. 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
  4. 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 << 1) | porta.n); on edit* cleared up my question a bit
  5. 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.
  6. mchristisen

    Usb Serial Port!

    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 when connected and ignore all else. It looks like your module has jumpers to carry the USB 5V to your PIC I/O.
  7. mchristisen

    Usb Serial Port!

    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.
  8. mchristisen

    Delays On 18f

    disregard previous post. my problem is different, delay routines work at 10MHz but do not work with HS PLL enabled for 40MHz.
  9. mchristisen

    Delays On 18f

    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?
  10. mchristisen

    Silly Printf() Question

    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("Hello Everybody"); } } With this print function and a level shifter you should be able to send data to your PC. Hope this helps. Matt Christisen
  11. 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 to tie your I/O directly in and get by. If the switch voltage is lower, add a resistor inline to drop it down to what you need. matt
  12. mchristisen

    Strings

    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 variable as "int string[]" and waste a lot of space. Is this correct? This was my incorrect guess at how a string "ABC" might be stored and is just binary ABC/null placed end to end. I understand what you are saying Dave but not quite sure of the significance. In its basic form I understand what a pointer is but not how it is useful. I have yet to dive head first into pointers. thanks for all your help, matt
  13. mchristisen

    Strings

    Oh Ok, each individual character is kept as an "unsigned char". Makes perfect sense.... thanks emte
  14. 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
  15. mchristisen

    Chip Info ?

    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.
×