dumb question


Closed Thread
Results 1 to 40 of 94

Thread: dumb question

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Do you have MPASM installed? Does not really matter for this stuff but you will need it later.

    Why only one LED? You should have two. And you were to work on a button part of the code to change the way the LEDs blink.
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Do you have MPASM installed? Does not really matter for this stuff but you will need it later.

    Why only one LED? You should have two. And you were to work on a button part of the code to change the way the LEDs blink.
    Yes,I have it installed,I think,is the one with comes on cd with PICKIT 2? Is named MPASMWIN?If is this,yes,I have it installed.
    Sorry but didnt get this:And you were to work on a button part of the code to change the way the LEDs blink.
    To work where?Do I have to change something?

  3. #3
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Ok,I did it now,I ansemble the two codes toghether and now are blinking both Leds.
    Code:
    '****************************************************************
    '*  Name    : P16F690.INC                                       *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 25/08/2009                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
     '16F690 DEMO
      '  
        DEFINE OSC 8       'Comment the 4Mhz and uncomment these for 8Mhz
        OSCCON=%01110000
    
        DEFINE OSC 4           'This is the default setting
        OSCCON=%01100000
          
        @ device  pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
      
         TRISC = %00000000   '0 will make the pins an output, 1 will make them inputs
         'VARS
        LED1    VAR PORTC.0
        LED2    VAR PORTC.1
        START:
        HIGH LED1
        LOW  LED2
        PAUSE 250
        LOW  LED1
        HIGH LED2
        PAUSE 250
        PORTC = %00000001
        PAUSE 250
        PORTC = %00000010
        GOTO START
    With this code is blinking LED 1 and 2
    Last edited by osceola; - 24th August 2009 at 23:29.

  4. #4
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    With this code is blinking LED no.1 and 4.
    Code:
    '16F690 DEMO
      '  
        DEFINE OSC 8       'Comment the 4Mhz and uncomment these for 8Mhz
        OSCCON=%01110000
    
        DEFINE OSC 4           'This is the default setting
        OSCCON=%01100000
          
        @ device  pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
      
         TRISC = %00000000   '0 will make the pins an output, 1 will make them inputs
         'VARS
        LED1    VAR PORTC.2
        LED2    VAR PORTC.3
        START:
        HIGH LED1
        LOW  LED2
        PAUSE 250
        LOW  LED1
        HIGH LED2
        PAUSE 250
        PORTC = %00000001
        PAUSE 250
        PORTC = %00000010
        GOTO START

  5. #5
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    With this code is blinking LED no.1 and 3...and also change timer to 500

    Code:
    '16F690 DEMO
      '  
        DEFINE OSC 8       'Comment the 4Mhz and uncomment these for 8Mhz
        OSCCON=%01110000
    
        DEFINE OSC 4           'This is the default setting
        OSCCON=%01100000
          
        @ device  pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
      
         TRISC = %00000000   '0 will make the pins an output, 1 will make them inputs
         'VARS
        LED1    VAR PORTC.0
        LED2    VAR PORTC.2
        START:
        HIGH LED1
        LOW  LED2
        PAUSE 250
        LOW  LED1
        HIGH LED2
        PAUSE 500
        PORTC = %00000001
        PAUSE 500
        PORTC = %00000010
        GOTO START

  6. #6
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    ..and here I change PORTC order , timer and Leds:
    Code:
     '16F690 DEMO
      '  
        DEFINE OSC 8       'Comment the 4Mhz and uncomment these for 8Mhz
        OSCCON=%01110000
    
        DEFINE OSC 4           'This is the default setting
        OSCCON=%01100000
          
        @ device  pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
      
         TRISC = %00000000   '0 will make the pins an output, 1 will make them inputs
         'VARS
        LED1    VAR PORTC.0
        LED2    VAR PORTC.3
        START:
        HIGH LED1
        LOW  LED2
        PAUSE 250
        LOW  LED1
        HIGH LED2
        PAUSE 1500
        PORTC = %00000010
        PAUSE 1500
        PORTC = %00000001
        GOTO START

  7. #7
    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 osceola View Post
    Sorry but didnt get this:And you were to work on a button part of the code to change the way the LEDs blink.
    To work where?Do I have to change something?
    Now you have to write your own code so when you push the button on the demo board a different set of LEDs blink. The manual will be a help while doing this.

    The code you have posted has two oscillator settings, you only want one.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Witch manual?And isnt the way I did it before right?
    Last edited by osceola; - 25th August 2009 at 11:27.

  9. #9
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Just to understand

    I create this code,after the model you send me,but just to understand,I would like to know where do I have to make changes -because now is blinking one LED and then 3 LED at time:
    Code:
    '****************************************************************
    '*  Name    : P16F690.INC                                       *
    '*  Author  : [ Osceola ]                                       *
    '*  Notice  : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 25/08/2009                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : 16F690 DEMO                                       *
    '*          :                                                   *
    '****************************************************************
    '16F690 DEMO
      ' 
        DEFINE OSC 4           
        OSCCON=%01100000
          
        @ device  pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
        TRISC = %00101010   '0 will make the pins an output, 1 will make them inputs
         'VARS
        LED1    VAR PORTC.0
        LED2    VAR PORTC.1
        LED3    Var PORTC.2
        LED4    VAR PORTC.3
        START:
        HIGH LED1
        LOW  LED2
        HIGH LED3
        LOW  LED4
        PAUSE 300
        LOW  LED1
        HIGH LED2
        LOW  LED3
        HIGH LED4
        PAUSE 300
        PORTC = %00000111
        PAUSE 300
        HIGH LED1
        LOW  LED2
        HIGH LED3
        LOW  LED4
        PAUSE 300
        LOW  LED1
        HIGH LED2
        LOW  LED3
        HIGH LED4
        PORTC = %11100000
        GOTO START

  10. #10
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    And here the LEDs blink in other way:
    Code:
    '****************************************************************
    '*  Name    : P16F690.INC                                       *
    '*  Author  : [ Osceola ]                                       *
    '*  Notice  : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 25/08/2009                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : 16F690 DEMO                                       *
    '*          :                                                   *
    '****************************************************************
    '16F690 DEMO
      ' 
        DEFINE OSC 4           
        OSCCON=%01100000
          
        @ device  pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
        TRISC = %00101010   '0 will make the pins an output, 1 will make them inputs
         'VARS
        LED1    VAR PORTC.0
        LED2    VAR PORTC.1
        LED3    Var PORTC.2
        LED4    VAR PORTC.3
        START:
        HIGH LED1
        LOW  LED2
        HIGH LED3
        LOW  LED4
        PAUSE 300
        LOW  LED1
        HIGH LED2
        LOW  LED3
        HIGH LED4
        PAUSE 300
        PORTC = %00000111
        PAUSE 300
        HIGH LED1
        LOW  LED2
        HIGH LED3
        LOW  LED4
        PAUSE 300
        LOW  LED1
        HIGH LED2
        LOW  LED3
        HIGH LED4
        PAUSE 300
        PORTC = %11100000
        PAUSE 300
        GOTO START

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


    Did you find this post helpful? Yes | No

    Default

    What does this do?
    Code:
    PORTC = %11100000
    The manual you can not find is linked on the page where you got your demo.

    This page has samples that you need to work through and understand
    http://www.melabs.com/resources/samples.htm#code
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. AN Question for "word" variable read The serial port
    By redfoen in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th December 2007, 17:39
  2. really simple, dumb question
    By picster in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd March 2007, 22:02
  3. Question for a math guru
    By Christopher4187 in forum General
    Replies: 3
    Last Post: - 22nd November 2006, 09:45
  4. Please answer my first question
    By John_001 in forum Off Topic
    Replies: 1
    Last Post: - 15th September 2006, 06:49
  5. Dumb question
    By Christopher4187 in forum General
    Replies: 0
    Last Post: - 20th June 2006, 12:02

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