Trying to use PIC18F4520 to do asynchronous serial transmit to PC


Closed Thread
Results 1 to 4 of 4
  1. #1
    TurboLS's Avatar
    TurboLS Guest

    Default Trying to use PIC18F4520 to do asynchronous serial transmit to PC

    OK, we are using this PIC18F4520 to do a few things:

    1.) Generate 5 TTL clocking signals for a CCD
    - we are using a 20Mhz ceramic resonator and we have EPIC Win set to HS when programming. We have the first and third pins of the resonator wired to OSC1 and OSC2 (pins 13 and 14 on the PIC), respectively.

    2.) Acquire analog data from the CCD and convert to 8 - 10 bit word for serial transmission. (the faster we can do these conversions and send them out the better).

    3.) Eventually use some sort of interrupt to start the clocking signals and the A/D process and end it as well.

    My questions are as follows:

    First of all, how do I wire the **** thing up to a serial connection? Can I just use any 8 digital I/O ports in sequence?

    Also, I know the manual says this chip does 10-bit A/D, but if I want to use asynchronous serial transmission, I think 8-bit would work better, is there any way to select that?

    All programming is being done in PicBasic Pro and EPIC Win.

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    TurboLS

    it's all in the Manual

    for AD-conversion see:

    ADCIN see section 5.2
    ("DEFINE ADC_BITS 8")

    for serial communication see:

    "SERIN" section 5.71
    "SERIN2" section 5.72
    "SEROUT" section 5.73
    "SEROUT2" section 5.74
    "HSERIN" section 5.30
    "HSEROUT" section 5.32
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3
    toalan's Avatar
    toalan Guest


    Did you find this post helpful? Yes | No

    Default

    take your 10 bit value and divide by 4 and get an 8 bit value, you lose 2 bits of resolution. after you divide by 4 just send it out using Serout or Hserout, you can send out a 10 bit word variable as long as it is less than 256, IE it will only send out the lower 8 bits of the 10 bit variable.

  4. #4
    TurboLS's Avatar
    TurboLS Guest


    Did you find this post helpful? Yes | No

    Default

    Oh yeah, I got all the serial transfer stuff working. Thanks again guys.

Similar Threads

  1. Replies: 11
    Last Post: - 12th July 2008, 02:36
  2. PIC18F4680 to PC via MAX232 (RS232 serial) no output
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th April 2008, 20:39
  3. interfacing to the pc serial port
    By kelangfei in forum General
    Replies: 4
    Last Post: - 7th October 2007, 22:35
  4. PC serial port funny
    By nicjo in forum Serial
    Replies: 13
    Last Post: - 6th February 2007, 05:34
  5. Interrupt and Serial communication to PC.
    By obaskirt in forum mel PIC BASIC
    Replies: 2
    Last Post: - 17th June 2005, 20:01

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts