Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Newbie - Minor Questions on PIC

Status
Not open for further replies.

devonsc

Advanced Member level 4
Full Member level 1
Joined
Nov 30, 2004
Messages
115
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,298
Activity points
1,931
Hi there, hope you guys dont mind me starting this post and throw in general and simple questions regarding PIC from time to time. Newbie here...need help. Thanks in advance.

Would like to ask, if you guys mind explaining regarding the following instruction in PIC:

cblock 0x20
MULTA
MULTB
endc

Would like to ask what does the the term "cblock" means. Thanks in advance.
 

devonsc said:
cblock 0x20
MULTA
MULTB
endc

Would like to ask what does the the term "cblock" means.

Hi,

MULTA and MULTB are variables, each one is a 8 bits block.
'CBLOCK' Means you start a variable block ( area ), where MULTA and MULTB are stocked
In that example, MULTA will be placed at 0x20 adress, and MULTB at 0x21, and so on...
Every you start a CBLOCK block, you must end with 'ENDC'

Regards,

Manu
 

Thanks for that detaili explanation. Another question: Would like to ask regarding the multiplication process. For instance, if I were to multiply a 8-bit binary number with 4. But, I'm only concern the LSB of the 8-bit binary value, can I sort multiply a "4-bit binary" with the value 4? For intance:

8-bit binary value = B'00001010' ;where 1010 is my main concern
multiply by four.

Can I consider this as multiply 4-bit binary value by the value four? Meaning, can I write the following code?

CLRC
RLF MULTB,F
RLF MULTB,F

By just shifting twice, can I say that I've multiply the 4-bit binary value by four? Will writing the code in this manner, where I neglect the other four MSB of the 8-bit binary number cause any problems? For your information, the other four MSB of the 8-bit binary number always remains '0'. Advice needed. Thanks in advance...
 

Salam,

If the 4 bits MSB are 0, There is no problem multiple the number by 4 using two left rotate instructions. DON'T forgot to clear the Carry flag before.

Bye
 

Thanks. Another question :) Sorry...

How do I represent a number in binary form? For instance, how do I write 5.5 decimal in binary form?
 

Hi !

5.5 dec = 101.1 binary

Bits at left of the point are positive powers and bits at right of the point are negative powers.

So, 101.1 equals
1 * 2^2 + 0 * 2^1 + 1 * 2^0 + 1 * 2 ^ -1
= 4 + 0 + 1 + 0.5
= 5.5
 

Hi there, would like to ask regarding the implementation of the LCD. From scratch, if I were to use a LCD to display certain parameters, do you guys mind guiding me, what are the considerations that I need to first consider? As in the drivers and etc...The only thing that I have in mind is to use a 16x2 line LCD. Help really needed.

Please? Thanks in advance.
 

Thanks for everything...Questions again.

a.) If I wrote this:

ADC2 MOVLW B'01001001'
MOVWF ADCON0
BSF ADCON0,2
CHECK2 BTFSC ADCON0,2
GOTO CHECK2
MOVF ADRESH,W
MOVWF RESULTHIGH2
BSF STATUS,5
MOVF ADRESL,W
BCF STATUS,5
MOVWF RESULTLOW2
RETURN

How should I write the EQU for the RESULTLOW2 and RESULTHIGH2?

Meaning,

RESULTHIGH2 EQU ?
RESULTLOW2 EQU ?

Does it mean that these registers can be any from the General Purpose Register? If I'm using 16F876, means I can use from 20H to 7FH? Is this right? Thanks in advance...

**************************************************

b.) Another question, sorry...

ADC2 MOVLW B'01001001'
MOVWF ADCON0

How do I write the instructions to wait for the acquisition time after MOVWF? Help really needed...please? Thanks

**************************************************

c.) Another question,

In the following:

CALL ABC

In the simulation, using MPLAB, I have error stating that symbol ABC not previously defined, mind to give some advice on this matter? Please? I'm confused as only some of my CALL ***, the errors are shown but some are not.
 

Hi,

Need help again, hope you guys dont mind helping. Thanks in advance. In the PIC programming, using assembly language, how do I generate a specific delay? As in, how do I know specifically I'm generating, for instance a 5 seconds delay? Do you guys mind teaching how do I determine how long is a cycle? Am I right to say that it depends on the crystal that I'm using, where if I'm using a 20Mhz crystal, it means that 1 cycle is 1/20Mhz?
 

devonsc said:
Hi,

Need help again, hope you guys dont mind helping. Thanks in advance. In the PIC programming, using assembly language, how do I generate a specific delay? As in, how do I know specifically I'm generating, for instance a 5 seconds delay? Do you guys mind teaching how do I determine how long is a cycle? Am I right to say that it depends on the crystal that I'm using, where if I'm using a 20Mhz crystal, it means that 1 cycle is 1/20Mhz?

Devonsc,

The PIC runs at 4 ticks per cycle, so it's running at 5 million instructions/sec,
not 20 million. Here is a web page that I think you'll find most interesting:

**broken link removed**

Nick
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top