Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 20, 2024, 01:52:18 13:52


Login with username, password and session length


Pages: [1]
Print
Author Topic: CCS newbee 12F675 question  (Read 4997 times)
0 Members and 1 Guest are viewing this topic.
hexadecimal
Inactive

Offline Offline

Posts: 6

Thank You
-Given: 0
-Receive: 2


« on: March 13, 2009, 08:00:33 08:00 »

Hi All
my primary compailer proton basic for microcontroller
I am newbee for C I prefer CCS compailer but I want to use 12F675 my simple project 
how the setup  GPIO and TRIS ? I tried portb but compailer give error
Could you write me simple code like blink the led
best regards
Logged
mustuva
Junior Member
**
Offline Offline

Posts: 55

Thank You
-Given: 167
-Receive: 110


« Reply #1 on: March 13, 2009, 11:03:00 11:03 »

Hi,
Simple example
Code:
   GPIO = 0;
   TRISIO=0x08;

   while(1) {
      GPIO = 0;
      delay_us(400-2);
      GPIO = 0x37;
      delay_us(19600-3);
   }

or you can use bit definitions
Code:
#bit _StD  = GPIO.4
#bit _Tx   = GPIO.5
BOOLEAN ready;
...
    TRISIO=0x1F;
...
   state = 0;
   ready=FALSE;
   while(1) {
      while(ready == _StD);
      ready=_StD;
      if(ready) {
         key=T[0x0F & GPIO];
         switch(state) {
...
               if(key=='8')
                  _Tx=1;

Logged
hexadecimal
Inactive

Offline Offline

Posts: 6

Thank You
-Given: 0
-Receive: 2


« Reply #2 on: March 13, 2009, 12:16:20 12:16 »


Thanks for quickly reply
Logged
ivanovic
Inactive

Offline Offline

Posts: 2

Thank You
-Given: 2
-Receive: 0


« Reply #3 on: March 16, 2009, 02:18:10 14:18 »

on 14 bit 8pin part ports are A and all (pin_ax) and on 12bit part port are B and all (pin_bx)
12f675 are 14 bit so I'm using pin_a0>5
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC