Reading analogs with 16F877


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1

    Default

    This is what i have so far, Still nothing
    No mention of ansel in the data sheet, any other idea i have replaced the chip also and tested with a ossiliscope to try and see if mabe the chips was faulty still nothing

    '*Serial port Setup 9600 8N1*
    TXSTA = %10100100
    RCSTA = %10010000
    DEFINE HSER_BAUD 9600 ; 9600 Baud
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 ; Clear overflow automatically
    DEFINE HSER_SPBRG 129
    TRISC = %10000000 'RC7 as RX(input) rest as output

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818

    Default

    Quote Originally Posted by Andre_Pretorius View Post
    This is what i have so far, Still nothing
    No mention of ansel in the data sheet, any other idea i have replaced the chip also and tested with a ossiliscope to try and see if mabe the chips was faulty still nothing

    '*Serial port Setup 9600 8N1*
    TXSTA = %10100100
    RCSTA = %10010000
    DEFINE HSER_BAUD 9600 ; 9600 Baud
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 ; Clear overflow automatically
    DEFINE HSER_SPBRG 129
    TRISC = %10000000 'RC7 as RX(input) rest as output

    RC6 output, RC7 input edit: I gotta rub my eyes ! Been starin' at this "Confuser too long" Anyway you're using Herserout, so you should be using RC6, Yes? So what's on the other end? Is it working? Oh , just nosey, what's in the ansi include file? Must be something of yours, never seen that one . . .
    Cut this from your code and see:
    TXSTA = %10100100
    RCSTA = %10010000
    Last edited by Archangel; - 8th July 2008 at 08:19.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3

    Default

    Current code still nothing

    '*Serial port Setup 9600 8N1*
    DEFINE HSER_BAUD 9600 ; 9600 Baud
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 ; Clear overflow automatically
    DEFINE HSER_SPBRG 129

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818

    Default

    Hi Andre,
    OK I think I would go to square 1. Open a new window in MCS and put in only the basics, your hser defines, a byte variable, load a value into the variable and then an HSEROUT statement, also the config statements, and OSC define. see if that works, no includes, no AD enable code, in fact disable for this test, then after this works, start adding stuff back in.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5

    Default

    Just a bit more info here is the inc file i am using, in answer to JOE s question the the device on the other side is my PC running hyper terminal

    NOLIST
    ifdef PM_USED
    LIST
    include 'M16F87x.INC' ; PM header
    device pic16F877, hs_osc, wdt_on, pwrt_on, lvp_off, protect_off
    XALL
    NOLIST
    else
    LIST
    LIST p = 16F877, r = dec, w = -302
    INCLUDE "P16F877.INC" ; MPASM Header
    __config _HS_OSC & _WDT_ON & _PWRTE_ON & _LVP_OFF & _CP_OFF
    NOLIST
    endif
    LIST

  6. #6

    Default

    thanks Joe s i did it but still nothing, I am now running a new PIC with LED's on the TX and RX lines just to elimenate any hardware problems here is the current code


    DEFINE OSC 20 ' Define crystal as 20Mhz

    '*Serial port Setup 9600 8N1*
    DEFINE HSER_BAUD 9600 ; 9600 Baud
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 ; Clear overflow automatically
    DEFINE HSER_SPBRG 129

    TRISC = %10000000 'RC7 as RX(input) rest as output

    Main:
    HSEROUT ["hallo"]
    goto main
    end

  7. #7

    Talking

    Thank you JOE S i found the problem, i went back to a led and a button when that did not wanted to work i went back to the hardware and found i used the wrong caps on the oscilator fixing it solved all the problems. again thank you for all the help

Similar Threads

  1. 16f877 and ps/2 keyboard error???
    By boraciner in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th July 2009, 09:14
  2. Replies: 8
    Last Post: - 5th May 2009, 21:10
  3. DS18B20 error reading
    By Gaetano in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 29th August 2007, 17:21
  4. Pot reading jumping like crazy!!!
    By champion in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 20th November 2006, 22:24
  5. 4 Quadrant dc drive with 16F877
    By mns45 in forum mel PIC BASIC
    Replies: 2
    Last Post: - 23rd February 2006, 14:05

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