pic telemetry system


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,133


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by comwarrior View Post
    I'd actually ruled out using a resister type voltage devider for the reason that it draws curent from the source your measuring... I had thaught of an opamp or another type of amplifier...
    Then use higher value resistors (Mohms) and a suitable opamp as an unity gain buffer, like the LMC662 series (rail to rail).


    Quote Originally Posted by comwarrior View Post
    Also, I think the PBP way of handling interupts is stupid... you should be allowed to write interupt handlers in PB without PBP inserting all that extra code...
    Read my post again. Answer is DT-INTS. It has nothing to do with PBP interrupts. Credits go to Darrel Taylor for his great contribution. Look also his site www.pbpgroup.com for the software.

    Ioannis

    P.S. I still have that old ZX Spectrum and Zeus assembler. What days was those...

  2. #2


    Did you find this post helpful? Yes | No

    Default

    ok, i see what your saying for interupt handling and i'll read more when i get fedup trying to sort the comms out...

    here is a little test program i've done to try and debug the problem with the serial comms...

    Code:
    include "modedefs.bas"
    include "bs1defs.bas"
    Define CONF_WORD = 	0x3d71
    Define  OSC				4				' Set clock speed
    
    Define  ADC_BITS        10     			' Set number of bits in result
    Define  ADC_CLOCK       3     			' Set clock source (3=rc)
    Define  ADC_SAMPLEUS    50    			' Set sampling time in uS
    
    SPBRG = 25              ' Set baud rate to 2400
    RCSTA = %10010000       ' Enable serial port and continuous receive
    TXSTA = %00100000       ' Enable transmit and asynchronous mode
    
    RCSTA = %10010000       ' Enable serial port and continuous receive
    TXSTA = %00100000       ' Enable transmit and asynchronous mode
    
    ADT1 var word							' Create ADT1 to store curent ad conversion for AD channel 0
    ADT2 var word                   		' Create ADT2 to store curent ad conversion for AD channel 1
    ADT1MAX var word						' Create ADT1MAX to store curent ADC0 max val
    ADT1MAX = 0
    ADT2MAX var word						' Create ADT2MAX to store curent ADC1 max val
    ADT2MAX = 0
    ADT1VAL var word
    ADT1VAL = 0
    ADT2VAL var word
    ADT2VAL = 0
    ADV1 var word
    
    TRISE = 255							' Set PortE to all inputs
    TRISD = 0							' Set PortD to all outputs
    TRISC = 0							' Set PortC to all outputs
    TRISB = 0							' Set PortB to all outputs
    TRISA = 255 						' Set PORTA to all input
    ADCON1 = 0 							' PORTA is analog
    
    HSEROUT [" initialised",10,13]
    SEROUT PORTB.1,t9600,[" initialised",10,13]
    
    Loop:
    ADCIN 0, ADT1
    HSEROUT [DEC5 ADT1,10,13]
    SEROUT PORTB.1,t9600,[#ADT1,10]
    goto Loop
    end
    From software UART i get...

    Code:
    +¥ֻ±Í•´
    0
    0
    software uart output is reporting incorrect stop bits when it sends the "initialising" stream...

    I should re-point out, i'm experimenting in a PIC simulator untill i get the right output...
    i have a pair of 16F877's due to arive tomarow and JDM programmer and max232 converts (serial and USB versions) due to arive at any time...

    I know i've not included the half second pause for ADC...
    so, what have i missed out from my initialisations?

    Thanks

  3. #3


    Did you find this post helpful? Yes | No

    Default

    and now... i'm having Floting Point Math 'issues' too...

    FPM sux...

  4. #4


    Did you find this post helpful? Yes | No

    Default

    ok, i got it to output the voltage... so, the analog input now output as a voltage over serial connection... so i'm posting my code for anyone else that wants to use it...

    Code:
    Loop:
    ADCIN 0, ADT1
    ADT1 = ADT1 / 64
    VARHIGH = ((48 * ADT1) / 10000)
    VARLOW = ((48 * ADT1) - (((48 * ADT1) / 10000) * 10000)) / 100
    
    HSEROUT ["DEC: ", DEC5 ADT1," V: ",DEC5 VARHIGH,".",DEC5 VARLOW,10]
    GOTO Loop:
    It's actually reading 2% low in the simulation... but thats good enough for me... may be a completely diferent case when in hardware...

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,133


    Did you find this post helpful? Yes | No

    Default

    In your soft com maybe you have to use n9600 instead of t9600.

    Ioannis

  6. #6


    Did you find this post helpful? Yes | No

    Default

    i tried all combinations of inverted output with none inverted input (into the software uart screen), vica versa and the combo's between...

    but the weird thing is... after the first line it gets all the numbers correct... so, it's almost like a sync problem... but this is all done in sim software, so why would their be and sync problems...

    next job on my telemetry system is to make a counter... or more precisely, an RPM counter...

    I'm mauling over creating a software uart buffer so that while it's waiting for the next AD conversion it can be sending the data...


    I miss the good days of sending a full byte to a hardware uart in one go and have the program go do something else... I loved having 8/16 byte buffers on uarts...
    I also (kinda) loved frying z80 chips when i got hardware wrong... programming in machine code, tape drives, 3" floppies... ahhh those were the days... although, battery backed ram modules were cool...

  7. #7
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I miss the good days of sending a full byte to a hardware uart in one go and have the program go do something else...
    But that's EXACTLY what you do with a PICs USART anyway...

    Actually thinking about it...

    I also (kinda) loved frying z80 chips when i got hardware wrong... programming in machine code, tape drives, 3" floppies... ahhh those were the days... although, battery backed ram modules were cool...
    You can do all of the above with PICs too...

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  2. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  3. PIC16F877A - Timer0 won't interrupt
    By WishMaster^ in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 25th April 2007, 08:25
  4. calibration clock 12f508
    By volcane in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th December 2006, 10:33
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

Members who have read this thread : 0

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