dumb question - Page 2


Closed Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 41 to 80 of 94

Thread: dumb question

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


    Did you find this post helpful? Yes | No

    Default

    For now use Micro Code Studio and MPASAM as the assembler. I am hearing about problems with MPLAB right now.
    The file you need to comment the lines in is in the PBP directory.

    Assuming you have the 16F690.inc file commented on the correct lines like the above thread shows... This code should have a couple LEDs blinking.

    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
          
        'The first line is if you are using PM, the second if you are using MPASAM
      '  @ device  pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
        @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
      
        'VARS
        LED1    VAR PORTC.0
        LED2    VAR PORTC.1
        
        START:
        HIGH LED1
        LOW  LED2
        PAUSE 250
        LOW  LED1
        HIGH LED2
        PAUSE 250
        GOTO START
    This should do the same as the above code but in a different way.
    Code:
    '16F690 DEMO_2
      '  DEFINE OSC 8       'Comment the 4Mhz and uncomment these for 8Mhz
      '  OSCCON=%01110000
    
        DEFINE OSC 4           'This is the default setting
        OSCCON=%01100000
          
        'The first line is if you are using PM, the second if you are using MPASAM
      '  @ device  pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
        @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
        
        TRISC = %00000000   '0 will make the pins an output, 1 will make them inputs
        
        START:
        PORTC = %00000001
        PAUSE 250
        PORTC = %00000010
        GOTO START
    I do not have the demo board that you have, so I hope I did not make a mistake.
    Play with these and look in the manual to see how to add a button for an input.
    Then change things so when the button is pressed the LEDs blink differently.
    Dave
    Always wear safety glasses while programming.

  2. #42
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Ok,I think we miss a lesson first of this:how to use Micro Code Studio,how compiling a file and how convert it to hex files and after load it to chip

  3. #43
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    I compile that code with Micro Code Studio and
    at the first cod only blink Led no2 on the board without pressing nothing
    at the second code stay On Led no1 without pressing nothing
    and in the compiler I got this error when compiling
    Error LED2.ASM 49 : [235] opcode expected instead of '_config
    Im using Micro Code Studio with PICBASIC PRO Compiler Demo
    Last edited by osceola; - 23rd August 2009 at 01:14.

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


    Did you find this post helpful? Yes | No

    Default

    In MCS on the toolbar click View then go to Compiler and program options. Then go to the Assembler tab. You pick MPASAM there. If the box is unchecked then PM is used.
    Dave
    Always wear safety glasses while programming.

  5. #45
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Ok done that,have you read my previsious post before posting?I did compile it with PM,got some errors in it but at the end got some results

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


    Did you find this post helpful? Yes | No

    Default

    Using PM.
    Did you change the code to work with PM. The way I have it posted it is for MPASM.
    Maybe I confused things the way I did it. I was wanting to show both ways.
    Dave
    Always wear safety glasses while programming.

  7. #47
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Yes,I change code,but would be easy for start with using just 1 tipe of code.Thank you

  8. #48
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default bread

    Whats next ?

  9. #49
    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
    Whats next ?
    So you got the LEDs blinking? Did you get a button working to change the way the LEDs blink?

    Post your code so we can take a look.
    Dave
    Always wear safety glasses while programming.

  10. #50
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    I have compiled and anssemblex and importing hex file in pickit2 and write to PIC.with this code only the second Led from the board is blinking and when press buttonthe Led is not blink.
    [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

    'VARS
    LED1 VAR PORTC.0
    LED2 VAR PORTC.1

    START:
    HIGH LED1
    LOW LED2
    PAUSE 250
    LOW LED1
    HIGH LED2
    PAUSE 250
    GOTO START
    [code]

    The 2 code dont work
    [code]
    '16F690 DEMO_2
    ' DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
    ' OSCCON=%01110000

    DEFINE OSC 4 'This is the default setting
    OSCCON=%01100000

    'The first line is if you are using PM, the second if you are using MPASAM
    ' @ 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

    START:
    PORTC = %00000001
    PAUSE 250
    PORTC = %00000010
    GOTO START
    [code]
    I get this errors:
    Error LED2.ASM 45 : [225] undefined symbol 'osccon'
    ---------------46-------------------------'trisc'
    ---------------49-------------------------'portc'
    Fatal----------49 : [300] too many errors
    Last edited by osceola; - 23rd August 2009 at 16:43.

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


    Did you find this post helpful? Yes | No

    Default

    Did you comment the lines in the 16F690.inc file that is in the PBP directory? Like the config thread pointed out.

    In MCS do you have the box checked to use MPASM?
    Dave
    Always wear safety glasses while programming.

  12. #52
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Angry

    Quote Originally Posted by mackrackit View Post
    Did you comment the lines in the 16F690.inc file that is in the PBP directory? Like the config thread pointed out.

    In MCS do you have the box checked to use MPASM?
    In MCS box in unchecked,and where do I find the .inc file of PIC16F690?


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


    Did you find this post helpful? Yes | No

    Default

    The default install of Pic Basic Pro is in C:\PBP. That is where you will find all of the *.inc files for PBP.
    Dave
    Always wear safety glasses while programming.

  14. #54
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    I cant do it because I have the demo version of PBP,is other way to do that?

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


    Did you find this post helpful? Yes | No

    Default

    I have not had the demo version for a long time. I think the only thing you cannot do with the demo for the chips it supports is write code over a certain size.

    The install directory might be named something else though, so you will have to look around.
    Dave
    Always wear safety glasses while programming.

  16. #56
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Code:
    ;****************************************************************
    ;*  16F690.INC                                                  *
    ;*                                                              *
    ;*  Notice    : Copyright (c) 2006 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 05/23/06                                        *
    ;*  Version   : Demo                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
                  
    __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
            NOLIST
        endif
            LIST
            '16F690 DEMO_2
      '  DEFINE OSC 8       'Comment the 4Mhz and uncomment these for 8Mhz
      '  OSCCON=%01110000
    
        DEFINE OSC 4           'This is the default setting
        OSCCON=%01100000
          
            @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
        
        TRISC = %00000000   '0 will make the pins an output, 1 will make them inputs
        
        START:
        PORTC = %00000001
        PAUSE 250
        PORTC = %00000010
        GOTO START
    Results:
    ERROR Line 12: Syntax error.(16F690.INC)
    ERROR Line 13: Redefinition of LABEL NOLIST.(16F690.INC)
    ERROR Line 14: ENDIF without a matching IF..THEN.(16F690.INC)

  17. #57
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Did it again.I opened from the open file-16F690.INC and paste your code plus another file where past your code
    Code:
    ;****************************************************************
    ;*  16F690.INC                                                  *
    ;*                                                              *
    ;*  Notice    : Copyright (c) 2006 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 05/23/06                                        *
    ;*  Version   : Demo                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
                  
    __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
            NOLIST
        endif
            LIST
            '16F690 DEMO_2
      '  DEFINE OSC 8       'Comment the 4Mhz and uncomment these for 8Mhz
      '  OSCCON=%01110000
    
        DEFINE OSC 4           'This is the default setting
        OSCCON=%01100000
          
            @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLR_ON & _CPD_OFF
        
        TRISC = %00000000   '0 will make the pins an output, 1 will make them inputs
        
        START:
        PORTC = %00000001
        PAUSE 250
        PORTC = %00000010
        GOTO START
    First is 16F690.INC second is the code I paste it from you
    Code:
    '****************************************************************
    '*  Name    : UNTITLED.BAS                                      *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 23/08/2009                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    '16F690 DEMO_2
      '  DEFINE OSC 8       'Comment the 4Mhz and uncomment these for 8Mhz
      '  OSCCON=%01110000
    
        DEFINE OSC 4           'This is the default setting
        OSCCON=%01100000
        __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
        
        TRISC = %00000000   '0 will make the pins an output, 1 will make them inputs
        
        START:
        PORTC = %00000001
        PAUSE 250
        PORTC = %00000010
        GOTO START
    Results:
    ERROR Line 17 : Syntax error.(led.pbp)
    I dont understand nothing,so hard is it to create a code?!?...or I am really dumb?

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


    Did you find this post helpful? Yes | No

    Default

    You are not following the directions. Go back and read all of the links and post.

    Why do you need the card reader in the first place? Seems like a lot of work.
    Dave
    Always wear safety glasses while programming.

  19. #59
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Maybe you are right that Im not folowing the corect line of instructions,but my english is not so good and were are many explanation I dont get it.Would be easy if somebody could tell me in little words what to folow,I know how stressfull can be when you explain to somebody something and dont get it and you have to explain again and again....Honestly I really dont know were to start from

  20. #60
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Anyway...I want to learn and will do that again,thank you for helping me

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


    Did you find this post helpful? Yes | No

    Default

    Keep reading and trying. The LEDs will blink. But I would put the card reader on the back shelf for awhile.
    Dave
    Always wear safety glasses while programming.

  22. #62
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Thanks for being patience,at the end I did it!But with this code one led stay on,and wit other code I will post one led is blinking.whats next?
    Code:
    '****************************************************************
    '*  Name    : P16F690.INC                                       *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 24/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
        
        START:
        PORTC = %00000001
        PAUSE 250
        PORTC = %00000010
        GOTO START
    Last edited by osceola; - 24th August 2009 at 22:09.

  23. #63
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Thumbs up

    With this code one led is blinking.By the way,I had no succes compiling with MPASM,I use PM for both.
    Code:
    '****************************************************************
    '*  Name    : P16F690.INC                                       *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 24/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
      
      
        'VARS
        LED1    VAR PORTC.0
        LED2    VAR PORTC.1
        
        START:
        HIGH LED1
        LOW  LED2
        PAUSE 250
        LOW  LED1
        HIGH LED2
        PAUSE 250
        GOTO START
    I have now a breadboard,rezistors,leds and PIC16F628.Can we go on with it?
    THANK YOU!!!

  24. #64
    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.

  25. #65
    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?

  26. #66
    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.

  27. #67
    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

  28. #68
    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

  29. #69
    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

  30. #70
    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.

  31. #71
    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.

  32. #72
    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

  33. #73
    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

  34. #74
    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.

  35. #75
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Thank you!

  36. #76
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    I have compiled this and dont know why only 3 LEDs are blinking and the 4th doesnt blink.Could you tell me where I am mistaken,to understand better.Thank you
    Code:
    '****************************************************************
    '*  Name    : P16F690.INC                                       *
    '*  Author  : [osceola]                                         *
    '*  Notice  :                                                   *
    '*          : All Rights Reserved                               *
    '*  Date    : 25/08/2009                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    ' PICBASIC PRO program to blink 3 LEDS in sequence
    
    ' Define LOADER_USED to allow use of the boot loader.
    ' This will not affect normal program operation.
    Define	LOADER_USED	1
    DEFINE OSC 4           'This is the default setting
    OSCCON=%01100000
    @ device  pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
    i       Var     Byte		' Define loop variable
    LED1    VAR PORTC.0
    LED2    VAR PORTC.1
    LED3    Var PORTC.2
    LED4    VAR PORTC.3
    LEDS    Var     PORTC
    
    	TRISC = %00000000       ' Set PORTC to all output
    
    mainloop:  
            LEDs = 1
            Pause 500	
            LEDS = 2
            Pause 500	
            LEDS = 3		
            Pause 500		'
            LEDS = 4		
            Pause 500		' Delay for .5 seconds
            For i = 1 To 4          ' Go through For..Next loop 2 times
                    LEDS = LEDS << 1        ' Shift on LED one to left
                    Pause 500       ' Delay for .5 seconds
            Next i
    
            Goto mainloop		' Go back to mainloop and blink LED forever
    
            End

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


    Did you find this post helpful? Yes | No

    Default

    Decimal 4 equals what in Binary?

    That brings us back to:
    what does this do?
    Code:
    PORTC = %11100000
    you have it in one of your codes.
    Dave
    Always wear safety glasses while programming.

  38. #78
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Decimal 4 in Binary is 100.Sorry but dont understand,you said nothing about decimal to bynari conversions

  39. #79
    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
    Decimal 4 in Binary is 100.Sorry but dont understand,you said nothing about decimal to bynari conversions
    You are correct on bothe accounts. It is 100 and I did not say anything about conversions. But you put LEDS = 4 in your code and I have asked you twice about a other line you wrote and you have not answered.

    And you have not shown any attempts using the button on your demo board as an input.

    You said you wanted to learn. Have you been studying the PICs data sheet and the Pic Basic manual? It looks to me like you have not.

    So what do you really want? Do you want to learn or have someone write your code for you?
    Dave
    Always wear safety glasses while programming.

  40. #80
    Join Date
    Aug 2009
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    I dont want to be rude,sorry,but seems hard to me or I am really dumb and dont understand.I have a code witch I find on Microchip website,just want to modify it to write data to EEPROM-and for that I have to learn a lot,I have less then 2 weeks remain to present the project and Im going out of time...As you said,would be easy if somebody write the code,but I dont know who will do that,maybe somebody who wants to help me

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 : 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