Jump to content

Recommended Posts

Okay, maybe I am an idiot.  I can accept that.

 

I am trying to program a 12c509A after blowing my chances with a 12c508A.   All I'm trying to do is output an a number to the GPIO.  

 

 

 

#include <system.h>

main()
{  

// Setup I/O mask
/****************************
*	12c508a:
*  movlw 0x3E   ; load w with mask
*  tris gpio    ; put mask on I/O port	
*****************************/	

asm movlw 0 ; //all out
asm tris GPIO   ;

gpio = 0;  // Clear I/O

char count = 0;
while (1) {
 gpio = count++;
}

}

 

First, do I really have to resort to ASM to set the GPIO mask?

 

Second, do I need to do anything code-wise to use the internal oscillator other than set the option on my programmer (I'm using the EPIC)?

 

Third, has anyone created a 12c5xx definition file for use with the debugger/simulator?

 

Thanks!

CF

Link to post
Share on other sites

This worked almost as planned.  And more importantly I think I know why it didn't work 100%.

 

What I was expecting:

 

GP5 to pulse

GP4 to pulse twice as fast as GP5

GP3 to stay low (it's input only)

GP2 to pulse four times as fast as GP4

GP1 to pulse twice as fast as GP2

GP0 to pulse twice as fast as GP1

 

What I got:

 

GP5 - check

GP4 - check

GP3 - Stays high.  (as it should - but not as I expected)

GP2 - Gives me two solid horiztonal lines on my oscilloscope

GP1 - check

GP0 - check

 

The deal with GP2 is strange, but in reading the data sheets I see that GP2 can be configured as input with the OPTION register by setting T0CS (bit 5) to "1" , there-by overriding the TRIS register.

 

I don't know if this is the default mode, and it does not appear that C2C sets the option register on its own.  It also doen not appear that EPIC has this as an option.

 

C2C does save the internall Oscillator for you - and simply selecting internal INTRC on EPIC was enough.

 

Hope this helps for those of you who are a begginer like myself and have similar questions. :P

 

-CF

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...