Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Ads

Discussion Groups

Discussion Groups | Piclist | Bit-Banging on multiple pins

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

Bit-Banging on multiple pins - kg4pid - Mar 20 4:20:00 2006

I have been trying to figure out a way to direct a bit-banging program 
to different pins. I have a project that needs to be able to send 
serial data out different pins that are in turn connected to different 
devices. I also have a program that reads a DS18S20 temp sensor but 
doesn't use any of the serial numbers of the sensor therefore I would 
like to be able to direct the program to look at a different pin to get 
its data from more than one temp sensor. The programs are currently 
hard coded to a paricular pin. How can I change the programs so the 
pins can be changed while the program is running? If I duplicate the 
Bit-Banging program and change the assigned pins it will eat up alot of 
my program space. Any examples would be great.

Thanks Max
	


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )


RE: Bit-Banging on multiple pins - Wouter van Ooijen - Mar 20 4:22:00 2006

> I have been trying to figure out a way to direct a 
> bit-banging program to different pins.

- change the code to use a mask instead of a particular bit, and change
the mask to select a specific pin

- use an external 1-to-N analog switch

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu
	


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

RE: Bit-Banging on multiple pins - Alan Marconett - Mar 20 13:19:00 2006

Hi Max,

How about using switch statements?  Put a bit toggle to a different pin in
each case of the switch.

You could also do your toggle with a mask passed to the output routine.  |=
with the mask, or &= ~MASK to set or reset a particular bit in a "shadow"
register.

A mask could also be used to select a desired bit from a port read.

Alan  KM6VV

> 
> I have been trying to figure out a way to direct a bit-banging program
> to different pins. I have a project that needs to be able to send
> serial data out different pins that are in turn connected to different
> devices. I also have a program that reads a DS18S20 temp sensor but
> doesn't use any of the serial numbers of the sensor therefore I would
> like to be able to direct the program to look at a different pin to get
> its data from more than one temp sensor. The programs are currently
> hard coded to a paricular pin. How can I change the programs so the
> pins can be changed while the program is running? If I duplicate the
> Bit-Banging program and change the assigned pins it will eat up alot of
> my program space. Any examples would be great.
> 
> Thanks Max
>
	


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Bit-Banging on multiple pins - rj_satterlee - Mar 23 16:03:00 2006

Hiya-

One of the other posters mentioned a switch statement.  That's one
that I used a while ago.  Well, really, it's a computed goto, but it's
the same thing.

If you have an "index", representing a bit position, you can do 
something like this.

bithigh:

     movf    index,w
     addwf   index,w       ;multiply index by two
     addwf   pcl,w         ;jump via index
     bsf     SOMEPORT,SOMEBIT
     return
     bsf     SOMEOTHERPORT,SOMEOTHERBIT
     return
     bsf     THIRDPORT,THIRDBIT
     return
     bsf     FOURTHPORT,FOURTHBIT
     return
     etc, etc.

The index multiplying by two offsets the PCL for the TWO instructions
that each element of the subroutine requires.  If you need 3
instructions per element, multiply by three.

This assembly language "switch" statement (computed goto) gets around
the problem of not having a variable bit definition in the instruction
  set.

PLEASE MASK OFF YOUR INDEX AND FILL THE "UNUSED" PERMUTATIONS OF THE
TABLE WITH SOME SORT OF ERROR ROUTINE SO YOUR PROGRAM DOESN'T GO OFF
INTO THE WEEDS UNEXPECTEDLY.

Sorry I had to shout the last part, but it's important and could save
you a lot of grief in the future.

Hope that this helps.

  Cheers,

    Rich S.
	--- In piclist@picl..., "kg4pid" <kg4pid@...> wrote:
>
> I have been trying to figure out a way to direct a bit-banging program 
> to different pins. I have a project that needs to be able to send 
> serial data out different pins that are in turn connected to different 
> devices. I also have a program that reads a DS18S20 temp sensor but 
> doesn't use any of the serial numbers of the sensor therefore I would 
> like to be able to direct the program to look at a different pin to get 
> its data from more than one temp sensor. The programs are currently 
> hard coded to a paricular pin. How can I change the programs so the 
> pins can be changed while the program is running? If I duplicate the 
> Bit-Banging program and change the assigned pins it will eat up alot of 
> my program space. Any examples would be great.
> 
> Thanks Max
>
	


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

18F2550 - will this code work - Malcolm Crabbe - Mar 23 16:19:00 2006

Hi all,

I've downloaded the source and HEX files for a USB - transmitter 
interface from http://alessioandrea.altervista.org/rcjoyng.html

The problem is me and two of my mates can not get it to work.  the web 
site states that its 2550 / 2455 compatible, but we can't get any PC to 
recognise the device.  I've checked the data sheets and to the layman 
all I can see is that the 2550 has more memory, other than that they are 
the same - so it should work.

Also if I try re-compiling the asm code in MPLAB it falls over bigtime - 
any idea why ??

Cheers

Malcolm



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Brown out voltage - Malcolm Crabbe - Mar 24 8:24:00 2006

I'm a newbie when it comes to programming, but can work through an asm 
file to try and debug why things won't work.  Can someone inform me in 
layman's terms, what exactly does the brown out voltage do, and the 
implications of setting it in the config settings of the asm file.

The issue I'm having is with the BORV value in the config settings for a 
18F2550.  According to the amendments to the data sheet there are four 
values 25,28,45 and 48 setting the voltage to 2.5v, 2.8v, 4.5v and 4.8v 
respectively.  However these values cause the build to halt (MPLAB) - 
but a value of 28 works ??

Unfortunately I have no idea what the implications are of using this 
value - advice would be welcome

Malcolm



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Brown out voltage - john - Mar 24 16:16:00 2006

--- In piclist@picl..., Malcolm Crabbe <malcolm.crabbe@...> 
wrote:
>
> I'm a newbie when it comes to programming, but can work through an 
asm 
> file to try and debug why things won't work.  Can someone inform me 
in 
> layman's terms, what exactly does the brown out voltage do, and the 
> implications of setting it in the config settings of the asm file.
> 
> The issue I'm having is with the BORV value in the config settings 
for a 
> 18F2550.  According to the amendments to the data sheet there are 
four 
> values 25,28,45 and 48 setting the voltage to 2.5v, 2.8v, 4.5v and 
4.8v 
> respectively.  However these values cause the build to halt 
(MPLAB) - 
> but a value of 28 works ??
> 
> Unfortunately I have no idea what the implications are of using 
this 
> value - advice would be welcome
> 
> Malcolm
>
	When the supply voltage drops below the value you set for BORV the 
microcontroller will reset. This keeps the microcontroller from 
running when the supply voltage is too low to allow stable/proper 
execution of your program.

What build error do you get?
	


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Brown out voltage - Malcolm Crabbe - Mar 24 18:10:00 2006

Thanks John for the explanation.

I've resolved the build errors by downloading the latest version of 
MPLABS which has the latest INC files

Cheers

Malcolm

john wrote:

> When the supply voltage drops below the value you set for BORV the
>
>microcontroller will reset. This keeps the microcontroller from 
>running when the supply voltage is too low to allow stable/proper 
>execution of your program.
>
>What build error do you get?
>
>
>
>
>
>
>
>to unsubscribe, go to http://www.yahoogroups.com and follow the instructions 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Brown out voltage - Phil Seakins - Mar 25 1:41:00 2006

At 10:24 PM 24/03/2006, Malcolm Crabbe wrote:

 >I'm a newbie when it comes to programming, but can work
 >through an asm file to try and debug why things won't work.
 >Can someone inform me in layman's terms, what exactly does
 >the brown out voltage do, and the implications of setting
 >it in the config settings of the asm file

A brownout reset occurs at a pre-determined level to warn you of an 
impending power outage. This gives you time to take the necessary 
steps to shut down critical hardware and to save any dynamic data the 
processor might be carrying in its registers. For most simple apps 
this is not necessary.

Eg., my dishwasher is uP controlled. Had the designers been smarter 
they would have utilised the brownout feature and made my dishwasher 
capable of taking up where it left off after a power outage. As it is 
it just loses its mind. A bit different for a uWave oven - it's safer 
to demand user intervention, how is it to know the user hasn't removed the food.



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )