[Swansea Hackspace] Re: Hackspace Digest, Vol 6, Issue 9

Tim Moore timmoore47 at gmail.com
Sun Jun 23 19:14:31 BST 2013


Slowly getting it together on the Pic demo program.  I've retyped the
source and have this:-

 * File:   cointoss5.c
 * Author: Tim
 *
 * Created on 20 June 2013, 07:51
 */

#include <stdio.h>
#include <stdlib.h>
#include <xc.h>
#include <pic12f1840.h>

#define INT_OSC 500000L
#define _XTAL_FREQ _INT_OSC

/* 12.0 page 101 setup the ports
 */

TRISAbits.TRISA0 = 0;
TRISAbits.TRISA1 = 0;
TRISAbits.TRISA2 = 1;

/*  DISABLE ANALOG FEATURES */

ANSELAbits.ANS0 = 0;
ANSELAbits.ANS1 = 0;
ANSELAbits.ANS2 = 0;

/*   page 107 enable weak pullup on A2  */
WPUAbits.WPUA2 = 1;
OPTION_REGbits.nWPUEN = 0;

uint8_t random_byte = 0xB4;

void dorand(void)
{
    asm("BCF STATUS,0");
    asm("RRF _random_byte,W");
    asm("BTFSC STATUS,0");
    asm("XORLW 0xB4");
    asm("MOVWF _random_byte");

}

int main(int argc, char** argv) {

    while (1) {
             // Wait for button to press (go low)
        while (PORTAbits.RA2) {};
                // toss the coin
                dorand();
                // set the lights

        if (random_byte & 0x01)  {
                PORTAbits.RA0 = 1;
                PORTAbits.RA1 = 0;
            } else {
                PORTAbits.RA0 = 0;
                PORTAbits.RA1 = 1;
            }

    }
    return (EXIT_SUCCESS);
}


_______________

which yields an error message of...

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf


make[1]: Entering directory `C:/Users/Arun/MPLABXProjects/cointoss.X'


make  -f nbproject/Makefile-default.mk
dist/default/production/cointoss.X.production.hex


make[2]: Entering directory `C:/Users/Arun/MPLABXProjects/cointoss.X'


"C:\Program Files (x86)\Microchip\xc8\v1.12\bin\xc8.exe" --pass1
--chip=12F1840 -Q -G --asmlist  --double=24 --float=24
--opt=default,+asm,-asmfile,+speed,-space,-debug --addrqual=ignore
--mode=free -P -N255 --warn=0
--summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032
--runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib
"--errformat=%%f:%%l: error: %%s" "--warnformat=%%f:%%l: warning: %%s"
"--msgformat=%%f:%%l: advisory: %%s"
-obuild/default/production/cointoss5.p1  cointoss5.c
(908) exit status = 1


make[2]: *** [build/default/production/cointoss5.p1] Error 1


make[1]: *** [.build-conf] Error 2

cointoss5.c:2: warning: missing basic type; int assumed
cointoss5.c:2: error: ";" expected
cointoss5.c:19: warning: missing basic type; int assumed
cointoss5.c:19: error: type redeclared
cointoss5.c:19: error: conflicting declarations for variable "TRISAbits"
(C:\Program Files (x86)\Microchip\xc8\v1.12

\include\pic12f1840.h:983)

make[2]: Leaving directory `C:/Users/Arun/MPLABXProjects/cointoss.X'
make[1]: Leaving directory `C:/Users/Arun/MPLABXProjects/cointoss.X'
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 818ms)


_____________________

which would indicate I'm made errors in the source or I've set up MPLA|B
wrong or both......  *LOL*

Ooooo.....

;  )

Tim_1



On 20 June 2013 12:22, <hackspace-request at swansea.hackspace.org.uk> wrote:

> Send Hackspace mailing list submissions to
>         hackspace at swansea.hackspace.org.uk
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://stoneship.org.uk/mailman/listinfo/hackspace
> or, via email, send a message with subject or body 'help' to
>         hackspace-request at swansea.hackspace.org.uk
>
> You can reach the person managing the list at
>         hackspace-owner at swansea.hackspace.org.uk
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Hackspace digest..."
>
>
> Today's Topics:
>
>    1. Re: Hackspace Digest, Vol 6, Issue 8 (Tim Moore)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 20 Jun 2013 12:22:48 +0100
> From: Tim Moore <timmoore47 at gmail.com>
> Subject: [Swansea Hackspace] Re: Hackspace Digest, Vol 6, Issue 8
> To: hackspace at swansea.hackspace.org.uk
> Message-ID:
>         <
> CAAEY5oNXfVFDCY3K7ApPFz6aDb+9RUq+Xxsuqgv3ki4+f2SqwQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Quote 'It would be nice to hear some suggestions of things we could
> try in future
> workshops. '
>
> I'd vote for Pic A/D experiment and we had logic 0 to 5/3.3V example on the
> very enjoyable recent meeting.  The same 12F1840 has A/D capability (?).
>
> Given that 2 hours seems comfortable for all concerned the learning curve
> on getting the computer and hardware going will take less time, so more
> time for experimenting.
>
> :  ))
>
> Tim_1
>
> On 20 June 2013 11:26, <hackspace-request at swansea.hackspace.org.uk> wrote:
>
> > Send Hackspace mailing list submissions to
> >         hackspace at swansea.hackspace.org.uk
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >         http://stoneship.org.uk/mailman/listinfo/hackspace
> > or, via email, send a message with subject or body 'help' to
> >         hackspace-request at swansea.hackspace.org.uk
> >
> > You can reach the person managing the list at
> >         hackspace-owner at swansea.hackspace.org.uk
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of Hackspace digest..."
> >
> >
> > Today's Topics:
> >
> >    1. Re: Hackspace Digest, Vol 6, Issue 7 (Tim Moore)
> >    2. Re: Re: Hackspace Digest, Vol 6, Issue 7 (Justin Mitchell)
> >    3. followup to 3rd technical meeting workshop (Justin Mitchell)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Wed, 19 Jun 2013 12:21:48 +0100
> > From: Tim Moore <timmoore47 at gmail.com>
> > Subject: [Swansea Hackspace] Re: Hackspace Digest, Vol 6, Issue 7
> > To: hackspace at swansea.hackspace.org.uk
> > Message-ID:
> >         <
> > CAAEY5oOOizN3i3j4U2Ux3G-H377_syqK0KoESj0bA42F5JgpwQ at mail.gmail.com>
> > Content-Type: text/plain; charset="windows-1252"
> >
> > Brilliant !   Just order 2 of them !  now similar problem:-
> >
> > Quote "The Programming device i was using was a PICkit 2"
> >
> > so what do I search for on Ebay to locate a cheapie version from China?
> >
> > the Farnell is is at least available but if China do one at half the
> price.
> >
> > I got the software running on another laptop, not sure how to
> configure/use
> > use it and I assume I enter the 'C' code and make a hex file from with
> the
> > IDE.
> >
> > I'll build the circuit first.
> >
> > Many thanks for your support !
> >
> > :  )))
> >
> > Tim_1
> >
> > On 19 June 2013 12:00, <hackspace-request at swansea.hackspace.org.uk>
> wrote:
> >
> > > Send Hackspace mailing list submissions to
> > >         hackspace at swansea.hackspace.org.uk
> > >
> > > To subscribe or unsubscribe via the World Wide Web, visit
> > >         http://stoneship.org.uk/mailman/listinfo/hackspace
> > > or, via email, send a message with subject or body 'help' to
> > >         hackspace-request at swansea.hackspace.org.uk
> > >
> > > You can reach the person managing the list at
> > >         hackspace-owner at swansea.hackspace.org.uk
> > >
> > > When replying, please edit your Subject line so it is more specific
> > > than "Re: Contents of Hackspace digest..."
> > >
> > >
> > > Today's Topics:
> > >
> > >    1. Re: Hackspace Digest, Vol 6, Issue 6 (Tim Moore)
> > >    2. DMX512 (ceri clatworthy)
> > >    3. Re: Re: Hackspace Digest, Vol 6, Issue 6 (Justin Mitchell)
> > >
> > >
> > > ----------------------------------------------------------------------
> > >
> > > Message: 1
> > > Date: Tue, 18 Jun 2013 13:29:48 +0100
> > > From: Tim Moore <timmoore47 at gmail.com>
> > > Subject: [Swansea Hackspace] Re: Hackspace Digest, Vol 6, Issue 6
> > > To: hackspace at swansea.hackspace.org.uk
> > > Message-ID:
> > >         <
> > > CAAEY5oMQJETTUa6JyjZjvUu8vS+pZZ6yL-uuetDkDQ_A6Sh-XQ at mail.gmail.com>
> > > Content-Type: text/plain; charset="windows-1252"
> > >
> > > Most constructive event last night !  In every sense of the word !
>  *LOL*
> > >
> > > Busy downloading the Linux version of the software needed.
> > >
> > > I've got a couple of 12F1840 on order but got stuck on the two usb
> > gizmo’s
> > > that  were needed.
> > >
> > > 1_   the usb to +5V adapter and
> > >
> > > 2_  the MPLAB to breadboard programming tool.
> > >
> > > Anyone got any thoughts on an Ebay (or anywhere else) link to get them
> ?
> > >
> > > Not knowing what they are called has resulted in viewing several
> thousand
> > > mobile phone adapters *LOL*
> > >
> > > :  ))
> > >
> > > Tim_1
> > >
> > > On 14 June 2013 12:00, <hackspace-request at swansea.hackspace.org.uk>
> > wrote:
> > >
> > > > Send Hackspace mailing list submissions to
> > > >         hackspace at swansea.hackspace.org.uk
> > > >
> > > > To subscribe or unsubscribe via the World Wide Web, visit
> > > >         http://stoneship.org.uk/mailman/listinfo/hackspace
> > > > or, via email, send a message with subject or body 'help' to
> > > >         hackspace-request at swansea.hackspace.org.uk
> > > >
> > > > You can reach the person managing the list at
> > > >         hackspace-owner at swansea.hackspace.org.uk
> > > >
> > > > When replying, please edit your Subject line so it is more specific
> > > > than "Re: Contents of Hackspace digest..."
> > > >
> > > >
> > > > Today's Topics:
> > > >
> > > >    1. Re: Hackspace Digest, Vol 6, Issue 5 (Tim Moore)
> > > >
> > > >
> > > >
> ----------------------------------------------------------------------
> > > >
> > > > Message: 1
> > > > Date: Thu, 13 Jun 2013 13:41:03 +0100
> > > > From: Tim Moore <timmoore47 at gmail.com>
> > > > Subject: [Swansea Hackspace] Re: Hackspace Digest, Vol 6, Issue 5
> > > > To: hackspace at swansea.hackspace.org.uk
> > > > Message-ID:
> > > >         <
> > > > CAAEY5oP3rFuKAYmPAi7debKHcXPcvC_40P+grRDe5eTo_VTdNA at mail.gmail.com>
> > > > Content-Type: text/plain; charset="iso-8859-1"
> > > >
> > > > Very much hope to get to this event !
> > > >
> > > > :  )))
> > > >
> > > > Tim_1
> > > >
> > > > On 13 June 2013 12:00, <hackspace-request at swansea.hackspace.org.uk>
> > > wrote:
> > > >
> > > > > Send Hackspace mailing list submissions to
> > > > >         hackspace at swansea.hackspace.org.uk
> > > > >
> > > > > To subscribe or unsubscribe via the World Wide Web, visit
> > > > >         http://stoneship.org.uk/mailman/listinfo/hackspace
> > > > > or, via email, send a message with subject or body 'help' to
> > > > >         hackspace-request at swansea.hackspace.org.uk
> > > > >
> > > > > You can reach the person managing the list at
> > > > >         hackspace-owner at swansea.hackspace.org.uk
> > > > >
> > > > > When replying, please edit your Subject line so it is more specific
> > > > > than "Re: Contents of Hackspace digest..."
> > > > >
> > > > >
> > > > > Today's Topics:
> > > > >
> > > > >    1. [Announce] 3rd Technical Meeting - Mon 17th June (Justin
> > > Mitchell)
> > > > >
> > > > >
> > > > >
> > ----------------------------------------------------------------------
> > > > >
> > > > > Message: 1
> > > > > Date: Thu, 13 Jun 2013 10:20:57 +0100
> > > > > From: Justin Mitchell <justin at discordia.org.uk>
> > > > > Subject: [Swansea Hackspace] [Announce] 3rd Technical Meeting - Mon
> > > > >         17th June
> > > > > To: hackspace <hackspace at swansea.hackspace.org.uk>
> > > > > Message-ID: <1371115257.9475.2.camel at justin.llw.rokcorp.com>
> > > > > Content-Type: text/plain; charset="UTF-8"
> > > > >
> > > > > 7pm Monday 17th June 2013 - Castle Room, Fulton House
> > > > >
> > > > > Introduction to PIC workshop
> > > > >
> > > > > This meeting will be a hands on introduction to the PIC
> > > microcontroller,
> > > > > giving you all the chance to build a simple circuit and program the
> > > > > controller for it.
> > > > >
> > > > > All of the components and tools will be supplied, i have enough
> parts
> > > > > for 5 teams to work on their own projects, some example projects
> will
> > > be
> > > > > provided or you can make up your own.
> > > > >
> > > > > Could some people please bring a laptop with them, as ideally there
> > > > > would be one per team for you to write the software on. i will
> have a
> > > > > copy of all the relevant software with me, or download it in
> advance
> > > > > from the microchip website (MPLAB-X and the XC8 compiler)
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ------------------------------
> > > > >
> > > > > _______________________________________________
> > > > > Hackspace mailing list
> > > > > Hackspace at swansea.hackspace.org.uk
> > > > > http://stoneship.org.uk/mailman/listinfo/hackspace
> > > > >
> > > > >
> > > > > End of Hackspace Digest, Vol 6, Issue 5
> > > > > ***************************************
> > > > >
> > > > -------------- next part --------------
> > > > An HTML attachment was scrubbed...
> > > > URL:
> > > >
> > >
> >
> http://swansea.hackspace.org.uk/pipermail/hackspace/attachments/20130613/c36e83aa/attachment-0001.html
> > > >
> > > > ------------------------------
> > > >
> > > > _______________________________________________
> > > > Hackspace mailing list
> > > > Hackspace at swansea.hackspace.org.uk
> > > > http://stoneship.org.uk/mailman/listinfo/hackspace
> > > >
> > > >
> > > > End of Hackspace Digest, Vol 6, Issue 6
> > > > ***************************************
> > > >
> > > -------------- next part --------------
> > > An HTML attachment was scrubbed...
> > > URL:
> > >
> >
> http://swansea.hackspace.org.uk/pipermail/hackspace/attachments/20130618/e0bb6eb9/attachment-0001.html
> > >
> > > ------------------------------
> > >
> > > Message: 2
> > > Date: Tue, 18 Jun 2013 17:19:39 +0100
> > > From: ceri clatworthy <ceri.clatworthy at gmail.com>
> > > Subject: [Swansea Hackspace] DMX512
> > > To: "hackspace at swansea.hackspace.org.uk"
> > >         <hackspace at swansea.hackspace.org.uk>
> > > Message-ID:
> > >         <CAO=DJn8CoiE1BeNF7hV4v=
> > > dx-bhW0rrM0kvcGHi8igz3zf1LgA at mail.gmail.com>
> > > Content-Type: text/plain; charset="iso-8859-1"
> > >
> > > Sorry, but cannot remember who was looking for DMX512 stuff,
> > > but look at this:
> > >
> > > http://mbed.org/users/okini3939/notebook/dmx512/
> > >
> > > Cheers
> > >
> > > Ceri
> > > -------------- next part --------------
> > > An HTML attachment was scrubbed...
> > > URL:
> > >
> >
> http://swansea.hackspace.org.uk/pipermail/hackspace/attachments/20130618/064fc982/attachment-0001.html
> > >
> > > ------------------------------
> > >
> > > Message: 3
> > > Date: Tue, 18 Jun 2013 21:06:32 +0100
> > > From: Justin Mitchell <justin at discordia.org.uk>
> > > Subject: Re: [Swansea Hackspace] Re: Hackspace Digest, Vol 6, Issue 6
> > > To: hackspace at swansea.hackspace.org.uk
> > > Message-ID: <1371585992.13612.5.camel at emerald.geode.org.uk>
> > > Content-Type: text/plain; charset="UTF-8"
> > >
> > > On Tue, 2013-06-18 at 13:29 +0100, Tim Moore wrote:
> > > > Most constructive event last night !  In every sense of the word !
> > > > *LOL*
> > > >
> > > > Busy downloading the Linux version of the software needed.
> > > >
> > > > I've got a couple of 12F1840 on order but got stuck on the two usb
> > > > gizmo’s that  were needed.
> > > >
> > > > 1_   the usb to +5V adapter and
> > > >
> > > > 2_  the MPLAB to breadboard programming tool.
> > > >
> > > > Anyone got any thoughts on an Ebay (or anywhere else) link to get
> > > > them ?
> > >
> > > The usb-serial port that we were abusing for power is a PL2303HX
> > > http://www.ebay.co.uk/itm/321090000590
> > >
> > > The Programming device i was using was a PICkit 2
> > > Official ones can be quite expensive, but there are many cheap clone
> > > versions that work just the same.
> > >
> > > The cheapest ones i see on ebay come from china, so expect a couple of
> > > weeks lead time on those.
> > >
> > >
> > >
> > >
> > >
> > >
> > > ------------------------------
> > >
> > > _______________________________________________
> > > Hackspace mailing list
> > > Hackspace at swansea.hackspace.org.uk
> > > http://stoneship.org.uk/mailman/listinfo/hackspace
> > >
> > >
> > > End of Hackspace Digest, Vol 6, Issue 7
> > > ***************************************
> > >
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL:
> >
> http://swansea.hackspace.org.uk/pipermail/hackspace/attachments/20130619/3dc95cef/attachment-0001.html
> >
> > ------------------------------
> >
> > Message: 2
> > Date: Wed, 19 Jun 2013 12:46:06 +0100
> > From: Justin Mitchell <justin at discordia.org.uk>
> > Subject: Re: [Swansea Hackspace] Re: Hackspace Digest, Vol 6, Issue 7
> > To: hackspace at swansea.hackspace.org.uk
> > Message-ID: <1371642366.16196.8.camel at emerald.geode.org.uk>
> > Content-Type: text/plain; charset="UTF-8"
> >
> > On Wed, 2013-06-19 at 12:21 +0100, Tim Moore wrote:
> > > Quote "The Programming device i was using was a PICkit 2"
> > >
> > > so what do I search for on Ebay to locate a cheapie version from
> > > China?
> > >
> > > the Farnell is is at least available but if China do one at half the
> > > price.
> >
> > 'pickit 2 clone' i see one for ÂŁ11.66
> >
> > or get a 'pickit 3' if you want better features.
> >
> >
> > > I got the software running on another laptop, not sure how to
> > > configure/use use it and I assume I enter the 'C' code and make a hex
> > > file from with the IDE.
> >
> > The handout went through all the steps for writing the software, other
> > than the (hopefuly obvious) step of clicking 'build'
> >
> > the reason i was using the hex file is that the pickit 2 driver thats
> > built into mplab doesn't believe it can talk to a 12F1840, but the stand
> > alone (seperate download) one does.
> >
> > mplab believes you need a pickit 3 for that device, but they may well
> > update the software eventually.
> >
> >
> >
> >
> >
> >
> > ------------------------------
> >
> > Message: 3
> > Date: Thu, 20 Jun 2013 11:26:47 +0100
> > From: Justin Mitchell <justin at discordia.org.uk>
> > Subject: [Swansea Hackspace] followup to 3rd technical meeting
> >         workshop
> > To: hackspace at swansea.hackspace.org.uk
> > Message-ID: <1371724007.18672.10.camel at quartz.geode.org.uk>
> > Content-Type: text/plain; charset="UTF-8"
> >
> > I have just updated the website with a copy of the pic workshop handout,
> > now updated to include bugfixes, and a circuit diagram.
> >
> > http://swansea.hackspace.org.uk/meetings/20130617.html
> >
> > I learnt a lot about holding workshops, and i hope some of you got a
> > useful taste of how simple it can be to create circuits controlled by
> > software running on cheap micro-controllers.
> >
> > It would be nice to hear some suggestions of things we could try in
> > future workshops.
> >
> > I have a variety of sensors and devices that i have plans and ideas
> > around, the USB-Serial ports you saw at the workshop, dallas 1-wire
> > temperature sensors, the ws2811 based LED strip lights, and some newly
> > arrived 6-axis accelerometer/gyro sensors.
> >
> >
> >
> >
> >
> >
> >
> > ------------------------------
> >
> > _______________________________________________
> > Hackspace mailing list
> > Hackspace at swansea.hackspace.org.uk
> > http://stoneship.org.uk/mailman/listinfo/hackspace
> >
> >
> > End of Hackspace Digest, Vol 6, Issue 8
> > ***************************************
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://swansea.hackspace.org.uk/pipermail/hackspace/attachments/20130620/b62c83d4/attachment.html
>
> ------------------------------
>
> _______________________________________________
> Hackspace mailing list
> Hackspace at swansea.hackspace.org.uk
> http://stoneship.org.uk/mailman/listinfo/hackspace
>
>
> End of Hackspace Digest, Vol 6, Issue 9
> ***************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://swansea.hackspace.org.uk/pipermail/hackspace/attachments/20130623/8d793864/attachment.html>


More information about the Hackspace mailing list