GP2 on a 10F202 as output


Closed Thread
Results 1 to 15 of 15
  1. #1
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251

    Default GP2 on a 10F202 as output

    I read the whole datasheet of the 10F202 and I did not succeed in finding how to set GP2 as an output.
    When I put a led via a resistor at GP0, GP1 and GP2 only the GP0 and GP1 leds are working the led on GP2 remains off. (not broken).
    See small example.
    What do I forget ??
    Code:
    		'test voor 10f202
    			
    		@ DEVICE PIC10F202,INTRC_OSC
    		@ DEVICE PIC10F202,MCLR_OFF
    		@ DEVICE PIC10F202,PROTECT_OFF
    		@ DEVICE PIC10F202,WDT_OFF
    		
    		DEFINE	OSC	4
    				
    		TRISIO	  = %00000000
    		OSCCAL.0  = 0
    		
    		UIT1	VAR	GPIO.0
    		UIT2	VAR	GPIO.1
    		UIT3	VAR	GPIO.2
    		IN1	VAR	GPIO.3
    		
    	
    		
    		
    
    	
    BEGIN:
    		IF IN1 = 0 Then
    		UIT1 = 0
    		UIT2 = 1
    		UIT3 = 0
    		EndIF
    		
    		IF IN1 = 1 Then
    		UIT1 = 1
    		UIT2 = 0
    		UIT3 = 1
    		EndIF
    		
    		GoTo BEGIN

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mat janssen View Post
    I read the whole datasheet of the 10F202 and I did not succeed in finding how to set GP2 as an output.
    When I put a led via a resistor at GP0, GP1 and GP2 only the GP0 and GP1 leds are working the led on GP2 remains off. (not broken).
    See small example.
    What do I forget ??
    Code:
    		'test voor 10f202
    			
    		@ DEVICE PIC10F202,INTRC_OSC
    		@ DEVICE PIC10F202,MCLR_OFF
    		@ DEVICE PIC10F202,PROTECT_OFF
    		@ DEVICE PIC10F202,WDT_OFF
    		
    		DEFINE	OSC	4
    				
    		TRISIO	  = %00000000
    		OSCCAL.0  = 0
    		
    		UIT1	VAR	GPIO.0 : UIT2	VAR	GPIO.1 : UIT3	VAR	GPIO.2 : IN1	VAR	GPIO.3
    	
    BEGIN:
    		IF IN1 = 0 Then
    		UIT1 = 0:UIT2 = 1:UIT3 = 0
    		EndIF
    		
    		IF IN1 = 1 Then
    		UIT1 = 1:UIT2 = 0:UIT3 = 1
    		EndIF
    		
    		GoTo BEGIN
    10F202 datasheet (DS41239A)....page 21 (Section 4.6) and page 37 (Section 8.0) will give you all the answers you need.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    i'll bet on
    Code:
    OPTION_REG.5=0
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    @ Skimask:
    I read that part. Thats why I put in the programm :OSCCAL.0 = 0

    @ Mister_e:
    You win the price. That helped.
    I read also that the option reg bit 5 should be 0 , but I wrote at that time in my programm OPTION.5 = 0 , and the compile gave me an error. I forgot to type it in the correct way.
    Thanks.
    Regards
    Mat

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    yup OPTION.5 won't work unless you decide to redefine it
    Code:
    @OPTION=OPTION_REG
    OPTION VAR BYTE EXT
        ' or the simple one
    OPTION VAR OPTION_REG
    Doesn't help if you don't know OPTION_REG

    In this case you could still open the filename.ASM file, there you'll have...
    Code:
    R0              		EQU	RAM_START + 000h
    R1              		EQU	RAM_START + 002h
    R2              		EQU	RAM_START + 004h
    FLAGS           		EQU	RAM_START + 006h
    R4              		EQU	RAM_START + 007h
    R3              		EQU	RAM_START + 008h
    GOP             		EQU	RAM_START + 00Ah
    OPTION_REG      		EQU	RAM_START + 00Bh
    RM1             		EQU	RAM_START + 00Ch
    RR1             		EQU	RAM_START + 00Dh
    SOFT_STACK_PTR  		EQU	RAM_START + 00Eh
    TRISIO          		EQU	RAM_START + 00Fh
    SOFT_STACK      		EQU	RAM_START + 010h
    Last edited by mister_e; - 7th January 2007 at 12:27.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Talking

    I know, but still !!

  7. #7
    Join Date
    Mar 2008
    Posts
    59


    Did you find this post helpful? Yes | No

    Cool 10f202

    I can not seem to program a 10f202 I always get "programming error at 0000" however if I read it I can write the info back to the chip?

  8. #8
    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 n0yox View Post
    I can not seem to program a 10f202 I always get "programming error at 0000" however if I read it I can write the info back to the chip?
    Code?
    What are you reading from the chip ?
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Sound high likely an ICSP problem. Which programmer & Software?

    Did you tried on a Ziff socket? Are your sure your ICSP circuit is properly implemented?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #10
    Join Date
    Mar 2008
    Posts
    59


    Did you find this post helpful? Yes | No

    Cool 10f202

    I am using an epic plus programmer ver.4.22 and picbasicpro ver 2.50. I have a homemade programming adapter. I can read the blank chip "all 0fff" and the calibration register. I can load the hex file that I just read but can not load the hex files I create. I have no problem with other micros, however this is the only micro I just this program adapter with?

    Thank you for your help!

  11. #11
    Join Date
    Mar 2008
    Posts
    59


    Did you find this post helpful? Yes | No

    Default program adapter

    I believe this is correct for the epic programmer?
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    What about the code you are trying to load?
    Dave
    Always wear safety glasses while programming.

  13. #13
    Join Date
    Mar 2008
    Posts
    59


    Did you find this post helpful? Yes | No

    Default blinky code

    @ DEVICE PIC10F202,INTRC_OSC
    @ DEVICE PIC10F202,MCLR_OFF
    @ DEVICE PIC10F202,PROTECT_OFF
    @ DEVICE PIC10F202,WDT_OFF
    DEFINE OSC 4

    BEGIN:
    high GPIO.0
    pause 500
    low GPIO.0
    pause 500
    GoTo BEGIN

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


    Did you find this post helpful? Yes | No

    Default

    @ device pic10f202,mclre_off
    Could be a missing "e" ???
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    _MCLRE_ON EQU H'0FFF'
    _MCLRE_OFF EQU H'0FEF'
    _CP_ON EQU H'0FF7'
    _CP_OFF EQU H'0FFF'
    _WDT_ON EQU H'0FFF'
    _WDT_OFF EQU H'0FFB'
    _IntRC_OSC EQU H'0FFF'

    Are the config options when using MPASM. PM might be different...
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Help changing CCP3 output pin
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th July 2008, 02:30
  2. Bit Banging input to output on PIC16F876A
    By Bronurstomp in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 26th June 2008, 19:50
  3. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46
  4. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19
  5. HSEROUT Newbie question/problem
    By Mark Scotford in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 11th July 2006, 14:44

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