| Author |
Message |
johncsl82
Joined: 16 Aug 2004 Posts: 106
|
01 Jul 2005 12:13 [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
hi.....
I already search the entrie post for some tutorial dealing with I/O..... but it seems I still have some problem dealing and understanding with the code..... it quite confusing me....
Anyway can you guys to help me out to clear thing up?
ok my questions are:
1. what is the function of "@" and how to utilize it? if A @ 0x03, means A = 0x03 or A address is fixed as 0x03 or else?
2.how do we receive an input coming from a pin?
3.how do we send an ouput to a pin?
4.how to detect incoming data? using infinte loop?
5.how to send or receive a group of binary (0111 0001)? does frequency or time matter?
6.how do we check the microcontroller frequency and modify it?
7.how do we check the microcontroller "time" and modify it?
8.how do declare our own interrupt, plus how to retrieve list of available intterupt in the microcontroller?
9.can we declare our own register?btw, i find register like RCREG, RCIF and etc etc how do we utilize it?
10.if send an ascii character like 'A' do we have to convert to hex then to binary and send it?
11.how do we make the program go into sleep or wait mode?
12.how do we utilize the option pin function, for example PIN PORT C 3 has 3 function, which are RC3/SCK/SCL... plus other available dunction on the microcontroller?
13.PORTB = 0x02 //set 4 bit mode? or it means PORTB1 = 1?
:confused:
Thanks
|
|
| Back to top |
|
 |
ful babu
Joined: 11 Nov 2004 Posts: 167 Helped: 11 Location: Singapore
|
02 Jul 2005 14:35 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
i recommend tat u go thru the manual of pic c and to understand the specific functions u hav to understand tat pic's various ragisters for tat u hav to hav a very good look at the pic's data sheet, i believe u will find the answers there, becaz i had the same sort of problem wen i started hitech pic c, if u hav still problems plz dont hesitate to ask,,,
rwgards
|
|
| Back to top |
|
 |
enigma460
Joined: 28 Dec 2001 Posts: 76 Helped: 3
|
02 Jul 2005 21:05 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
This might Help you out. Did a search here and did not find it.
Good Luck
Enigma460
|
|
| Back to top |
|
 |
metal
Joined: 21 Dec 2004 Posts: 369 Helped: 13
|
06 Jul 2005 0:04 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
Hello
If you have bought the PICC compiler, then you can have a direct customer support form Hi-Tech themselves, I think they will not hesitate to answer any question, even if its as simple as asking them, what is the differnece between PIC16F84 and PIC16F84A
My self I don't use any Hi-Tech product, but a friend told me they have excellent customer support.
Regards
|
|
| Back to top |
|
 |
xxtigerxx
Joined: 05 Jun 2001 Posts: 240 Helped: 5 Location: Greece
|
06 Jul 2005 6:58 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
1. what is the function of "@" and how to utilize it? if A @ 0x03, means A = 0x03 or A address is fixed as 0x03 or else?
the address of a is 0x03...
2.how do we receive an input coming from a pin?
ex
char value
value = PB5;
3.how do we send an ouput to a pin?
char value
if ( value == 1)
PB5 = 1;
else
PB5 = 0;
4.how to detect incoming data? using infinte loop?
or an interrupt
or
while ( PB5 == 1 ){
...........
........
}
5.how to send or receive a group of binary (0111 0001)? does frequency or time matter?
what do you mean uart?
6.how do we check the microcontroller frequency and modify it?
if the mcu has the ability to change the frequency
form the OSCCON
7.how do we check the microcontroller "time" and modify it?
???????????
10.if send an ascii character like 'A' do we have to convert to hex then to binary and send it?
NO
value = 'a';
13.PORTB = 0x02 //set 4 bit mode? or it means PORTB1 = 1?
PORTB = 0x02 equal to PORTB = 2 equal to PORTB = 0b00000010;
|
|
| Back to top |
|
 |
johncsl82
Joined: 16 Aug 2004 Posts: 106
|
06 Jul 2005 17:00 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
xxtigerxx... thank for reply
| Code: |
5.how to send or receive a group of binary (0111 0001)? does frequency or time matter?
what do you mean uart?
|
I mean software implementation rather than hardware(UART).......
let say i got a binary '0b0111 0001', if we send it to port a pin 0 (RA0)
we just put like RA0 = 0b0111 0001?
how about receving it in a group?
| Code: |
7.how do we check the microcontroller "time" and modify it?
???????????
|
"time" -> prescaler or TMR0 (8-bit timer/counter)
Thanks
|
|
| Back to top |
|
 |
OOP
Joined: 05 May 2005 Posts: 10 Helped: 2
|
10 Jul 2005 19:52 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
| see in files .h of hi-tech c or MPLaB C
|
|
| Back to top |
|
 |
pvinbox@yahoo.com
Joined: 28 May 2004 Posts: 122 Helped: 6 Location: Coimbatore, INDIA
|
11 Jul 2005 12:50 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
hai
10) registers like rereg and rcif are special function registers
this registers will be used to configure and control theat particular peripheral
Added after 4 minutes:
11.how do we make the program go into sleep or wait mode?
by executing the instruction sleep wecan go to the sleep mode
12.how do we utilize the option pin function, for example PIN PORT C 3 has 3 function, which are RC3/SCK/SCL... plus other available dunction on the microcontroller?
in this pins the peripehral functions are multiplexed so at a time we can use as a one
13.PORTB = 0x02 //set 4 bit mode? or it means PORTB1 = 1?
ya it is correct
there is no problem to study
you just go through the material more than one time to understand better
still you are not able to understand then do one more time reading
which will help you definitely then concepts you won't forget at any time
best of luck
|
|
| Back to top |
|
 |
Google AdSense

|
11 Jul 2005 12:50 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
johncsl82
Joined: 16 Aug 2004 Posts: 106
|
12 Jul 2005 1:11 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
i having a little problem here:
| Code: |
void main()
{
unsigned char rb, sb;
TRISA0 = 1;
TRISB1 = 0;
TRISB2 = 1;
TRISB6 = 0;
TRISB7 = 0;
RB6 = 0;
RB7 = 0;
sb = 0x0f;
rb = 0;
for(;;)
{
if(RA0 == 1)
{
//send8Bits(RB1, 0x0f);
RB1 = sb;
//rb = RB2;
}
rb = RB2;
//if(receive8Bits(RB2) == 0x0f)
if(rb == sb)
{
RB6 = 1;
RB7 = 0;
}
else
{
RB6 = 0;
RB7 = 1;
}
}
}
|
it seems that RB1 = sb; mean sending out 0b00001111 at a time, is not working..
but if I change sb = 1, it's working....
so does this mean i have to send bit by bit?
Thanks
|
|
| Back to top |
|
 |
juan_manuell
Joined: 23 Feb 2002 Posts: 120 Helped: 3 Location: Argentina
|
15 Jul 2005 15:29 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
Dear johncsl82
RB1 it is a bit and the bit 1 of port B
sb it is a char it have 8 bits
the compiler will put on RB1 the bit 0 of sb
you could do something like that to take out the bits
the simbol (>>n) makes a rotation to rigth of n bits
RB1 = sb // this put bit 0 out
wait some time
RB1 = sb >> 1; // this will put bit 1
wait some time
RB1 = sb >> 2; // this will put bit 2
if you catch the idea you could use a for stament
unsigned char ucN;
unsigned char ucTime;
for(ucN=0; ucN<=7; ucN++)
{
RB1 = sb >> ucN;
// delay to see it in pin
ucTime = 255;
while(ucTime--){};
}
hope this help you, other way it is using timer0 to put out bit in a sharp time
|
|
| Back to top |
|
 |
helios
Joined: 03 Jun 2005 Posts: 166 Helped: 12
|
22 Jul 2005 10:52 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
hea
if you catch the idea you could use a for stament
unsigned char ucN;
unsigned char ucTime;
for(ucN=0; ucN<=7; ucN++)
{
RB1 = sb >> ucN;
// delay to see it in pin
ucTime = 255;
while(ucTime--){};
}
and
RB1 it is a bit and the bit 1 of port B
sb it is a char it have 8 bits
the compiler will put on RB1 the bit 0 of sb
you could do something like that to take out the bits
the simbol (>>n) makes a rotation to rigth of n bits
RB1 = sb // this put bit 0 out
wait some time
RB1 = sb >> 1; // this will put bit 1
wait some time
RB1 = sb >> 2; // this will put bit 2
so delays r required
test some basic mode s first for all the timers
if u have a osscilosope and observe then it will be great
in hardware
hope this help you,
|
|
| Back to top |
|
 |
Cyrix-Cracker
Joined: 04 Aug 2005 Posts: 18 Helped: 2
|
05 Aug 2005 9:20 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
1. what is the function of "@" and how to utilize it? if A @ 0x03, means A = 0x03 or A address is fixed as 0x03 or else?
ans:
@ may sometimes as label
@ pointing address
but there are rules in assembly language that prohibits it.
@ 3:
instead
label3:
if conditions
goto label3
2.how do we receive an input coming from a pin?
ans:
a low or high input level
a digital signals
0 volts = 0 = off
5 volts= 1 = on;a floating signal
3.how do we send an ouput to a pin?
for a data port
pb.0=0x02 // first port - first bit send an output 0010
pb.1=0x03
4.how to detect incoming data? using infinte loop?
ans: compare variable,parameterss
do
{
var ++ // increment or decrement
if(var -compare-value) // detector for control
} while(Var-value) // control -infinite or not
5.how to send or receive a group of binary (0111 0001)? does frequency or time matter?
ans: somehow yes if you are grouping it into a bits ,byte, word - or equivalent data type but in syncronizations times matter most and frequency as well
6.how do we check the microcontroller frequency and modify it?
ans:
.. first you have to read the crystal oscilator or its resonator
that produce the pulse of the device-Microcontroller
7.how do we check the microcontroller "time" and modify it?
... need to know also the input clok.. then if you desired designing
clock variability device such as 555 or equivalent family
the formula-RC chargingConstant
F = 1/T
T=RC
8.how do declare our own interrupt, plus how to retrieve list of available intterupt in the microcontroller?
ans:
need to read the data sheet of whatever Microcontroller you want and find out
all the interrupt you are able to map inside its ROm -Interrupt architecture
or a compiler itself able to read the I/O Mapping
9.can we declare our own register?btw, i find register like RCREG, RCIF and etc etc how do we utilize it?
[b[i]]ans:
take note that in I/O map of its microcontroller architecture
the next addresses are reserved for a user temporary storage or say memory
ex
0000 - stack
01F0 - instruction
0FFF - Reserved temporary
FFFF -----
10.if send an ascii character like 'A' do we have to convert to hex then to binary and send it? [/i]
ans:
take note all dispaly are characters
' a',bc,d ...'1','3'
in digital system it has an equivalent aschi code in hex,
which hex also has an equivalent bits
ex
'a' = 40h = 01010>> this what you are processing inside the machine
11.how do we make the program go into sleep or wait mode?
ans:you use loop and its equivalent interrupt
12.how do we utilize the option pin function, for example PIN PORT C 3 has 3 function, which are RC3/SCK/SCL... plus other available dunction on the microcontroller?
13.PORTB = 0x02 //set 4 bit mode? or it means PORTB1 = 1?
you are refrerring to a declarations a hex value assigned to a port
say 2h= 0010
:confused:
maybe not this time anymore
wish i could help...Thanks
Cyrix-Cracker
|
|
| Back to top |
|
 |
adamahmet
Joined: 13 Oct 2003 Posts: 14
|
05 Aug 2005 15:37 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
1. what is the function of "@" and how to utilize it? if A @ 0x03, means A = 0x03 or A address is fixed as 0x03 or else?
I recommend not to use "@" instead use BANK1,BANK2... In most cases you cant follow the adress.
|
|
| Back to top |
|
 |
pvinbox@yahoo.com
Joined: 28 May 2004 Posts: 122 Helped: 6 Location: Coimbatore, INDIA
|
25 Sep 2005 13:28 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
hai
my suggestion is first go through the hitech c manual
then u will get answers for all this questions
|
|
| Back to top |
|
 |
Nimer
Joined: 26 Apr 2005 Posts: 216 Helped: 25 Location: PALISTINE
|
08 Oct 2005 21:34 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
hi guyes
could you please give me alink or upload abook about the pic microcontrolleres
thanks .....
|
|
| Back to top |
|
 |
bmn123
Joined: 23 Nov 2006 Posts: 13
|
23 Jan 2007 12:23 Re: [Help] Hi-tech PIC C Beginner need help on i/o |
|
|
|
|
Ouch I don't have the necessary points to download
Can a kind soul please donate some points to download this one? Thanks
|
|
| Back to top |
|
 |