12f675_fuse_about_to_blow!


Closed Thread
Results 1 to 40 of 929

Hybrid View

  1. #1
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    I'm on it.

    Could take a day or two (or three) though. One or two 'holes' to plug in LEDave's knowledge base, bear with me.

    As an aside here, is it just me or is there something 'magical' 'mystical' even about all this? You've a little black 'spider' with 14 legs and three wires attached and numbers appearing on a monitor at the press of a button, I love it.

    Must dash, work, work, work and a lot of reading to do.

    Dave

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by LEDave View Post
    As an aside here, is it just me or is there something 'magical' 'mystical' even about all this? You've a little black 'spider' with 14 legs and three wires attached and numbers appearing on a monitor at the press of a button, I love it.
    Kind of like science fiction.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Kind of like science fiction.
    Exactly,even stranger though!

    Here's tonight's effort, it works up to DEC255 then ouputs a zero for 256 etc, which is larger than a BYTE I'm thinking.

    Code:
    ANSEL   = %00000000    'Disable analog select so ports work as digital i/o.
    CMCON0  = %00000111    'Disable analog comparators.
    TRISA   = %00000000    'Set PORTA as OUTPUT.
    PORTA   = %00000000    'Set PORTA pins all low.
    TRISC   = %00000000    'Set PORTC as OUTPUT.
    PORTC   = %00000000    'Set PORTC pins all low.
    
    DEFINE OSC 4
    
    MYVAR  VAR BYTE 
     
    MAIN:
    PAUSE 250
    SERIN2 PORTC.5, 16780, [DEC MYVAR] 'MODE 16780 = 2400 BAUD INVERTED 
    IF MYVAR = MYVAR THEN HIGH PORTA.5 'LET'S YOU INPUT ANY NUMBER.
    PAUSE 5000
    low PORTA.5
    pause 250
    SEROUT2 PORTC.3, 16780, [HEX MYVAR, 10, 13] 'OUTPUT IN HEX 'MYVAR' 10=L_FEED 13=C_RETURN
    pause 5000
    GOTO MAIN
    Last edited by LEDave; - 13th April 2010 at 20:02.

  4. #4
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    From the second part of the brief:

    Could even send a couple of numbers and have an operation done on them and the results sent back to the PC.
    Hmm, a little stumped here. To my mind (after a lot of reading but obviously not enough!) when the first BYTE (number) arrives I need to send it to a memory location where it won't be overwritten when the second BYTE arrives.Then add the two together.

    The only thing I've found so far that has a seperate address element is this (I think):

    Code:
     Label VAR Size[Number of elements]
    I'm thinking: MYVAR VAR BYTE [1] which is two elements 0,1. then somehow add element 0 to element1.

    Warm or way off?

    Dave

  5. #5
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Now I'm thinking:

    Code:
     Label VAR Size[Number of elements]
    Might be used to output a block of data....Mmm..

    A little more research me thinks.

    Dave

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    it works up to DEC255 then ouputs a zero for 256 etc, which is larger than a BYTE I'm thinking.
    Yup, remember when counting not to start at 1 like we were taught in school.
    Always start at the origin... ZERO

    Hmm, a little stumped here. To my mind (after a lot of reading but obviously not enough!) when the first BYTE (number) arrives I need to send it to a memory location where it won't be overwritten when the second BYTE arrives.Then add the two together.

    The only thing I've found so far that has a seperate address element is this (I think):
    I was thinking along the lines of something like this for now
    Code:
    NUM1  VAR  BYTE
    NUM2  VAR  BYTE
    I was saving ARRAYs for a little latter
    I'm thinking: MYVAR VAR BYTE [1] which is two elements 0,1. then somehow add element 0 to element1.
    But if you want to read ahead...
    http://www.picbasic.co.uk/forum/showthread.php?t=544
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit

    But if you want to read ahead...
    I'm with you, reading ahead is ok but learn to walk then run (or crawl then walk in my case).

    Just out of interest would the ARRAY idea have worked?

    This code is just an idea, is it on the right lines?

    Code:
    SERIN2 PORTC.5, 16780, [DEC NUM1] 'MODE 16780 = 2400 BAUD INVERTED
    
    SERIN2 PORTC.5, 16780, [DEC NUM2] 'MODE 16780 = 2400 BAUD INVERTED
    
    LET TOTAL = NUM1 + NUM2
    
    SEROUT2 PORTC.3 TOTAL

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