Flash an LED 10F200 Tutorial

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Thank you Jay!

Is this something the crew at CCS would look upon with beaming approval ?

I have personally talked to 'Pops' there.:)
 

jayanthd

Joined Jul 4, 2015
945
Thank you Jay!

Is this something the crew at CCS would look upon with beaming approval ?

I have personally talked to 'Pops' there.:)
It is just an extra licence I have which I can share. It is ties to a licence name. Licence name cannot be changed but I can provide that licence. It is good to learn embedded C programming. It provides option of portability with little modification. You can easilt port C code to other MCUs.
With asm code you cannot port and thats why I don't do asm coding because I work with many MCU families.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Thank you Jay!

We're doing assembler for a couple reasons.

Masochism is probably one of them.:)

These tutorials actually work up to C.

Believe it's two sets of about 10 lessons in Assembler and then C starts.

Yes. CCS is a very good quality product.

Will PM you with some other questions.
 

jayanthd

Joined Jul 4, 2015
945
Thank you Jay!

We're doing assembler for a couple reasons.

Masochism is probably one of them.:)

These tutorials actually work up to C.

Believe it's two sets of about 10 lessons in Assembler and then C starts.

Yes. CCS is a very good quality product.

Will PM you with some other questions.
Ok. Anytime.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Back to business here!

'Exclusive or or exclusive disjunction is a logical operation that outputs true only when inputs differ (one is true, the other is false)

Okay. That's resolved.

Here was explanation in tutorial I sort of missed.

To flip, or toggle, a single bit – to change it from 0 to 1 or from 1 to 0, you can exclusive-or it with 1.
That is:
0 XOR 1 = 1
1 XOR 1 = 0

Looks like it leaves out:

0 XOR 0 = 0

At least now I'm ready to go back and take on rest of this section in tutorial.
 
Last edited:

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Here's definition for XORWF from datasheet.

Description:

Exclusive OR the contents of the W register with register ‘f’.

If ‘d’ is '0' the result is stored in the W register.

If ‘d’ is '1'’, the result is stored back in register ‘f’

I will apply this to tutorial tomorrow..
 

jayanthd

Joined Jul 4, 2015
945
Here's definition for XORWF from datasheet.

Description:

Exclusive OR the contents of the W register with register ‘f’.

If ‘d’ is '0' the result is stored in the W register.

If ‘d’ is '1'’, the result is stored back in register ‘f’

I will apply this to tutorial tomorrow..
if W = 0b01010101

and

f = 0b10101010

then

xoring them will result in 0b11111111

if W = f and if xored then result is 0
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Thank you Jay!

It would help if I would post definition for the RIGHT XOR instruction ! !

There are two XOR's in instruction set.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
XORLW from 10F200 instruction set summary

The contents of the W register are
XOR’ed with the 8-bit literal ‘k’.
The result is placed in the W
register.

Okay. This is better. LW is the simpler of the two instructions.Simpler than WF.

It is 'using' W twice. First time in the equation and second time to store the return in.

Jay pointed out these are 'byte oriented' instructions.

They mow through each bit.
 

OBW0549

Joined Mar 2, 2015
3,566
I question whether ever before in the history of the English language has so much been written about so little. Are you going to post a saga about every PIC instruction you learn? There are 33 of them!

I'm waiting in breathless anticipation for when you try to wrap your mind around the DECFSZ instruction...
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Thank you Max and OBW!

Let me look at code again and see how XORWF is being used.

Then do the equation.

I see what is going on.

The author starts out with XORWF and then changes the code to XORLW.

Far out!
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Thank you Max!

I am having a little bit of a problem with the use of GPIO.

It is being used twice.

First time for setting PIN 1 to an ouput.

;***** Initialisation
start
movlw b'111101' ; configure GP1 (only) as an output
tris GPIO

Then the second time like this.

flash
movlw b'000010' ; set GP1 high
movwf GPIO
movlw b'000000' ; set GP1 low
movwf GPIO
goto flash ; repeat forever

Want to figure out what value will be in W at start of XOR.

Going to take another look at GPIO definition and TRIS.
 

be80be

Joined Jul 5, 2008
2,072
movlw b'000010
thats what was in W LOl

EDIT you have windows 7 right the calculator has a programmer setting try it out.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Bebe Thanks!

Time has come to face MPLAB X IDE.

Want to load a value and look at it.

See new post. This one is still about tutorial though.
 
Top