<<Previous

Next>>

OWIN 

OWIN Pin, Mode,[ Item... ] 

Optionally send a reset pulse to a one-wire device and then read one or more bits or bytes of data from it, optionally ending with another reset pulse.

Pin may be a constant, 0 -15, or a variable that contains a number 0 -15 (e. g. B0) or a pin name (e. g. PORTA. 0).

Mode specifies whether a reset is sent before and/ or after the operation and the size of the data items, either bit or byte.

Mode bit number Effect
0 1 = send reset pulse before data
1 1 = send reset pulse after data
2 0 = byte-sized data, 1 = bit-sized data

Some Mode examples would be: Mode of 0 means no reset and byte-sized data, Mode of 1 means reset before data and byte-sized data, Mode of 4 means no reset and bit-sized data.

Item is one or more variables or modifiers separated by commas. The allowable modifiers are STR for reading data into a byte array variable and SKIP for skipping a number of input values.

The SKIP and STR modifiers are not supported for the 12-bit core PICmicro MCUs because of RAM and stack size limits.

OWIN PORTC. 0,0,[temperature\2, SKIP 4, count_remain, count_per_c]

This statement would receive bytes from a one-wire device on PORTC pin 0 with no reset pulse being sent. It would receive 2 bytes and put them into the byte array temperature, skip the next 4 bytes and then read the final 2 bytes into separate variables.

OWOUT 

OWOUT Pin, Mode,[ Item...] 

Optionally send a reset pulse to a one-wire device and then writes one or more bits or bytes of data from it, optionally ending with another reset pulse.

Pin may be a constant, 0 -15, or a variable that contains a number 0 -15 (e. g. B0) or a pin name (e. g. PORTA. 0).

Mode specifies whether a reset is sent before and/or after the operation and the size of the data items, either bit or byte.

Mode bit number Effect
0 1 = send reset pulse before data
1 1 = send reset pulse after data
2 0 = byte-sized data, 1 = bit-sized data

Some Mode examples would be: Mode of 0 means no reset and byte-sized data, Mode of 1 means reset before data and byte-sized data, Mode of 4 means no reset and bit-sized data.

Item is one or more constants, variables or modifiers separated by commas. The allowable modifiers are STR for sending data from a byte array variable and REP for sending a number of repeated values.

The REP and STR modifiers are not supported for the 12-bit core PICmicro MCUs because of RAM and stack size limits.

OWOUT PORTC. 0,1,[$ cc,$ be] 

This statement would send a reset pulse to a one-wire device on PORTC pin 0 followed by the bytes $cc and $be.

 PAUSE

PAUSE Period

Pause the program for Period milliseconds. Period is 16-bits, so delays can be up to 65,535 milliseconds (a little over a minute). Unlike the other delay functions (NAP and SLEEP), PAUSE doesn't put the microcontroller into low power mode. Thus, PAUSE consumes more power but is also much more accurate. It has the same accuracy as the system clock.

PAUSE assumes an oscillator frequency of 4MHz. If an oscillator other that 4MHz is used, PBP must be told using a DEFINE OSC command. See the section on speed for more information.

	PAUSE 1000 	' Delay for 1 second

 PAUSEUS

PAUSEUS Period

Pause the program for Period microseconds. Period is 16-bits, so delays can be up to 65,535 microseconds. Unlike the other delay functions (NAP and SLEEP), PAUSEUS doesn't put the microcontroller into low power mode. Thus, PAUSEUS consumes more power but is also much more accurate. It has the same accuracy as the system clock.

Because PAUSEUS takes a minimum number of cycles to operate, depending on the frequency of the oscillator, delays of less than a minimum number of microseconds are not possible using PAUSEUS. To obtain shorter delays, use an assembly language routine in an ASM..ENDASM construct.

OSC

Minimum delay

3 (3.58)

20us

4

24us

8

12us

10

8us

12

7us

16

5us

20

3us

25*

2us

32*

2us

33*

2us

40**

2us

* PIC17Cxxx and PIC18Cxxx only.
** PIC18Cxxx only.

PAUSEUS assumes an oscillator frequency of 4MHz. If an oscillator other that 4MHz is used, PBP must be told using a DEFINE OSC command. See the section on speed for more information.

	PAUSEUS 1000	' Delay for 1 millisecond
<<Previous

Next>>