Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

30f article project (note thread)

Status
Not open for further replies.
no update really, got some very screwy results going on! PSU reporting increase in current being drawn not much but gone from ~20mA to ~70mA, also cc keeps cutting in on the psu. so something is very not ok! i have a feeling the chip itself is playing up, have tried alot of settings for the OSC and the results dont match what i would expect, for example with pllx4 i still get a square wave of 234kHz watch window reports pll lock on, pllx8 gives me square wave of 1.8MHz so very not correct!. i am aeway tommorow but new chip should be here friday, plan is to redo board and start again. seems very easy to upset these 30f chips!
i want to get OSC sorted so i can move on. as a side plan i will post schematic and pcb layout for the max232 board, i am going to do a pcb for max232 ready for when i try the uart. as the chip has 2 uart i will use both chanels on the 232 chip and 2 sockets etc. so that at least might be useful for someone
 
ok before i update i want to moan!! i still havnt unpacked everything for the lab!! so loads of stuff i cant find yet. ALSO dad has been in here doing stuff so the lab is now a complete TIP!! GRRRRRRRRRRrrrrrrrrr. anyway

have changed psu just to make sure that any odd readings and the OC trip i kept getting wasnt down to the PSU, i am using exactly same model just a different unit, for the record the PSU is a HP6632A, these are utterly brilliant!
i have now put a socket on the board for crystals as seen in the following pic
osc socket.jpg


i couldnt find info in the datasheet about caps to use with a crystal but the family datasheet says to use between 22pf and 33pf, actually what it says is
OSC datasheet.JPG
this on page 194 of the family datasheet, the top line basically says to me take a wild guess between the values of 22pf and 33pf and take it from there

the value i chose was the first cap i found that was in the range and it happened to be 25pf, or to be precise
lcr 25.jpg
the other is 25.4pf so close enough!
so the board with a 12 MgHz crystal is bellow
osc socket 12.jpg
while the oscilloscope on this bench is a good LA and reasonable oscilloscope i am not sure how accurate this one is so i normally use it as a rough guide when i use the scope on it, i will at some point swap the scope over to one the other ones that i am pretty sure are fairly accurate. Anyway the following is a pic of the output from the crystal, now i dont know why but as i have never used a crystal before i was expecting to see a square wave that was fosc/4, but instead as those in the know will tell you i got the following
scope OSC.jpg
just so you know what i am using to do these simple tests its only the following code

C:
#include <p30fxxxx.h>
_FOSC(CSW_FSCM_OFF & HS);
_FWDT(WDT_OFF);
_FBORPOR(PBOR_OFF & MCLR_EN);
_FGS(CODE_PROT_OFF);
_FICD( ICS_PGD );
main()
{
    while(1){
                    TRISB = 0; // all PORTB pins output
                     PORTB = 0xff;
                     PORTB = 0x00;
                   }
}


and yes i know i am using 8 bit number not 16bit but for this i didnt think it was going matter!
now for the output i was moaning about in an earlier post, it seems the frequency was right! with the crystal its about 50% higher but then again the crystal is 50% than the internal frequency i was using. however as seen in the following pic the trace is still ugly!!
trace.jpg
i assume the fact its not a nice square wave has something to do with the output drivers on the pin, i dont know but might look into it at a later stage, if i have to make a wild guess then i would go with the mosfet driver charging and discharging etc, but its only a wild guess and i will look into it later. anyway thats where we are at! the socket allows me to change crystal easily if i want to switch frequency as we go, next up will be the RS232 layout and board or messing with timer's not sure wich yet but we are at least onto more interesting stuff! thats if anyone is still following my ramblings lol
 
Last edited:
ok reading up on timers etc, so may be no updates for a day or two!
 
just a quick update, solved the crappy looking square wave!! i was thinking about designing the max232 board and i got to the thinking part that says must remember to connect both GND's!!!!! light bulb moment, what i have been doing is a classic noob mistake. i normally use a old ATX power supply for projects and the gnd on them is connected to earth and so is my scope GND BUT i am now using the HP PSU and on the back it has a separate earth connection if you want it, so i am guessing that the GND from the PSU is isolated from earth. ANYWAY long story short i put a ground lead on the scope probe and bingo :D no more funny looking output or odd voltages being reported :D and heres a pic to prove it (ok i admit its not a perfect waveform but way better)
earth.jpg
 
i have to go and pick up a plant trailer with the family today it's a 6 hour round trip so i doubt i will get much done today :( , one thing i will do tho is start taking measurements of current draw, i have noticed a couple of odd things like more is drawn with pk3 attached than the ICD3 and more when the circuit isnt actually running etc, not going to do anything too scientific just take readings off the PSU, might also be worth trying a few different value crystals and see what affect they have on current drawn, aqnd then use internal with different PLL X. my reason for this is you can get a wide range of OSC on these chips just from the internal OSC, so if they drawn significantly less than a external crystal then for battery projects it would make sense to use internal where possible! well thats my thinking anyway.
also need to make progress with MAX232 board, is anyone interested in seeing that in pictures as its done or do i just go ahead and do it post the schematic and pic of finished product?
one buggeration is i cant find a 30f part in proteus! i dont want to sim it but would be handy for doing schematics. we have an old version of proteus and one of (i can't remember the name) on dads old uni laptop, these are/were licensed to the uni but dad brought the laptop off the IT guy there.
i havnt made a PCB for a very long time so it might take a few goes! anyway if anyone is interested i will do it as a pictorial. one other annoying thing is we have a A3 bed CNC machine here but it dosnt fit through the door into the house! its brand new a couple of years ago and has never ever been used! dad and a couple of mates got it for some project and never used it. would be great to use it for the drilling but i have no idea how, if anyone knows how to set these up for drilling PCB's and what kind of bits i need for it then let me know and i will get dad to set it up in the outside workshop, anyway that's all for now i need to read up on timers :D
 
just incase you thought this was dead it isnt! i am doing another project wich has priority, but the two may soon come together, in the other i may need to read some NTC thermistors or maybe LM temp sensors as well as dallas 18s20's, also software pwm might come into it for multi fan speed control, depending on wich way i go the 30f may be the main controller of choice for the ADC stuff because at 10 bits it can sample a max of 1,000000 times per sec, now i wont be going that fast but it can also read and convert all its ADC channels at the same time wich would be handy, and with 5 timers software pwm should be fairly simple, so i will update again when i get further
 
as promised before today i will post the 2 port rs232 drawing, as i need for another project anyway, and to get a bit further with this article i might put a 30f into other project (total overkill) but it will help get this done!
 
ok drawing done for RS232 board! the reason for why it is like it is can found in this thread rather than me pointing it all out again, besides this is just a record thread of notes for the article!
rs2321.JPG
 
still working on the layout, because i set myself the goal of using the other board offcut for this, it's proven a bit tricky! but so far this is what i have

232layout.JPG

will be neater than the last board :D
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top