Debugger/Dev Tool

Status
Not open for further replies.
It's here. Got the delivery notice. I wasn't home to sign and pay the parasites (customs/taxes). The post office is in the drug store here in town. Going to try to pick up tomorrow after work.
Worked too late Saturday to pick up. But the post office is open Sunday, so I picked it up.

Opened it, took lots of pictures and connected it to my SPI. Seems to work as advertised so far, but I need some more time with it before I've learned more than the extreme basics.
 
ok cool ...

heh as proof i still goto and use your site futz i just altered the 2 wire lcd main code for c18 and a sn74ls164 works nice!

Code:
#include <p18cxxx.h>
#include <stdio.h>
#include <delays.h>
#include <spi.h>

#pragma config WDT = OFF, LVP = OFF, OSC = HS
/***********************************
      Prototypes / Defines
***********************************/
void initSPI(void);
void e_togg(void);
void lcd_line(char line);
void lcd_cmd(unsigned char letter);
void lcd_char(unsigned char letter);
void lcd_string(char *senpoint);
void lcd_init(void);
void delay_ms(int ms);
void delay_us(int us);
void delay_s(int s);
void lcdByte(unsigned char dNyb,unsigned char rs);
char RTCRegRead(char adx);
void RTCRegWrite(char adx, char data);

#define CS LATCbits.LATC2
#define CS_T  TRISCbits.TRISC2
#define SCL_T TRISCbits.TRISC3
#define SDA_T TRISCbits.TRISC4
#define SDO_T TRISCbits.TRISC5

#define LCD_DAT_T TRISCbits.TRISC0
#define LCD_CLK_T TRISCbits.TRISC1

#define LCD_DAT LATCbits.LATC0
#define LCD_CLK LATCbits.LATC1

#define LCD_E_T TRISCbits.TRISC6
#define LCD_E   LATCbits.LATC6

char string[] = "                ";
unsigned char time[16];
/***********************************
            Main
***********************************/
void main(void){
    unsigned char tmp,tmp2;
    unsigned char buff[40];
    char i;

    ADCON1 = 0x0E;

    initSPI();
	lcd_init();

	lcd_line(1);
	sprintf(string,"  AtomSoftTech",0);
	lcd_string(&string);

	lcd_line(2);
	sprintf(string," 2-Wire 74LS164",0);
	lcd_string(&string);

    delay_s(3);

	lcd_line(2);
	sprintf(string,"  DS1306 TEST.  ",0);
	lcd_string(&string);

    delay_s(3);

    RTCRegWrite(0x80,0x00);
    RTCRegWrite(0x81,0x32);
    RTCRegWrite(0x82,0x66);
//0x00
//0x23
//0x56


    while(1){

    tmp = RTCRegRead(0x02);
    time[15] = (tmp >> 4) & 0x02;

    if(time[15] == 0) 
        time[15] = 'A' ;
    else 
        time[15] = 'P';

    time[14] = 0x20;

    tmp = RTCRegRead(0x00);
    time[13] = (tmp & 0x0F) + 0x30;
    time[12] = ((tmp >> 4) & 0x0F ) + 0x30;
    time[11] = ':';

    tmp = RTCRegRead(0x01);
    time[10] = (tmp & 0x0F) + 0x30;
    time[9] = ((tmp >> 4) & 0x0F ) + 0x30;
    time[8] = ':';

    tmp = RTCRegRead(0x02);
    time[7] = (tmp & 0x0F) + 0x30;
    time[6] = ((tmp >> 4) & 0x01 ) + 0x30;

    time[5] = 0x20;
    time[4] = ':';
    time[3] = 'e';
    time[2] = 'm';
    time[1] = 'i';
    time[0] = 'T';

	lcd_line(2);
	lcd_string(time);

    delay_ms(100);

    }
}


char RTCRegRead(char adx){
    char tmp;
    CS = 1;
        WriteSPI(adx); //sec
        tmp = ReadSPI();
    CS = 0;

    return tmp;
}

void RTCRegWrite(char adx, char data){
    CS = 1;
    WriteSPI(adx);
    WriteSPI(data);
    CS = 0;
}
void initSPI(void){
    CS_T = 0;       //CS is output
    SCL_T = 0;      //SCL is output
    SDA_T = 1;      //SDA is input
    SDO_T = 0;      //SDO is output

    OpenSPI(SPI_FOSC_4,MODE_10,SMPEND);         //[b]Had to change to SMPEND[/b]

    CS = 1;
        WriteSPI(0x8F);
        WriteSPI(0x00);
    CS = 0;

}

void lcd_string(char *senpoint){
    delay_ms(1);
	while(*senpoint != '\0'){
		lcd_char(*senpoint);
		senpoint++;
	}
}
void lcdByte(unsigned char dNyb,unsigned char rs){
	int i;

	LCD_DAT=0;							//Clear 74LS164 set initial bit to 0
	for(i=0;i<8;i++){				    //repeat for 8 bits
		LCD_CLK=1;LCD_CLK=0;			//write 0's to the 164
	}

	for(i=0;i<4;i++){				    //output the nybble
		if((dNyb & 0x08) != 0)
			LCD_DAT=1;
		else
			LCD_DAT=0;

		LCD_CLK=1;LCD_CLK=0;
		dNyb=dNyb<<1;
	}

	LCD_DAT = rs;						    //output the RS bit value
	LCD_CLK=1;LCD_CLK=0;

	LCD_DAT = 0;
	LCD_CLK=1;LCD_CLK=0;
	LCD_CLK=1;LCD_CLK=0;
	LCD_CLK=1;LCD_CLK=0;

	e_togg();
}

void e_togg(void){
	LCD_E=1;LCD_E=0;
}
void clk_togg(void){
	LCD_CLK=1;LCD_CLK=0;
}
void lcd_line(char line){
    if(line == 0x01)
        lcd_cmd(0x80);
    else
	    lcd_cmd(0xc0);
}

void lcd_cmd(unsigned char letter){
	unsigned char temp;
	temp=letter;
	temp=temp>>4;
	lcdByte(temp,0);
	temp=letter;
	temp=temp&0x0f;
	lcdByte(temp,0);
}

void lcd_char(unsigned char letter){
	unsigned char temp;
	temp=letter;
	temp=temp>>4;
	lcdByte(temp,1);
	temp=letter;
	temp=temp&0x0f;
	lcdByte(temp,1);
}

void lcd_init(void){

    LCD_E_T = 0;
    LCD_CLK_T = 0;
    LCD_DAT_T = 0;

	lcdByte(0x03,0);
	delay_ms(5);
	e_togg();
	delay_us(160);
	e_togg();
	delay_us(160);
	lcdByte(0x02,0);
	delay_us(160);
	lcd_cmd(0x28);					//set 4-bit mode and 2 lines
	delay_us(160);
	lcd_cmd(0x10);					//cursor move & shift left
	delay_us(160);
	lcd_cmd(0x06);					//entry mode = increment
	delay_us(160);
	lcd_cmd(0x0d);					//display on - cursor blink on
	delay_us(160);
	lcd_cmd(0x01);					//clear display
	delay_ms(500);
}

void delay_s(int s){
    int y;
    char x;

    for(y=0;y<s;y++)
        for(x=0;x<4;x++)
            delay_ms(250);

}

void delay_ms(int ms){
    int y;

    for(y=0;y<ms;y++)
        Delay1KTCYx(5);
}

void delay_us(int us){
    int y;
    char x;

    for(y=0;y<us;y++)
        for(x=0;x<5;x++)
            Nop();
}

Included some RTC stuff
 
Last edited:
Some photos and a few words about the Saleae Logic have been posted on my site. Have a look if you're interested in the Logic. Nice product!
 
NICE! thanks dude. I will deff get one now.

"Here's a macro of one of the probes in the open position. "
Nice picture dude. i never seen one that close. Nice view on data and i just cant wait to get one and play. I might not bother you all as much !
 
"Here's a macro of one of the probes in the open position. "
Nice picture dude. i never seen one that close. Nice view on data and i just cant wait to get one and play. I might not bother you all as much !
I can go closer than that. I have a set of +1,+2,+4 macro diopter filters I can put on. But I rarely bother. The camera does pretty decent without them anyway.
 
dude im like your student lol be my teacher dude. What camera do you use? Income tax is comming next year maybe march and i will get a few thousand dollars to play with. Im doing a nice $500 in electronics when i get it. I wouldnt mind spending extra for a nice camera.

I plan to spend $1000 on My computer and electronics and $500 on cloths so ill have anywhere from $500-$1500 extra. (Plus what i am planning to save would make it around $2000 total.)
 
What camera do you use?
Canon A650IS. Wanna buy it? I want to move up to a fatty DSLR, but I'm in no rush. They're expensive and overkill for what I do, but SO cool! The photos on my web-site are pretty much all I usually do.

Income tax is coming next year maybe march and I will get a few thousand dollars to play with.
You're not supposed to blow it! You gave the parasite gubbmint an interest-free loan, and at tax time they're required to give some back to you if you overpaid. Find out a way to pay less if you're getting big fat refunds. Put that money in your pocket, not the gubbmint's! Underpay the bastids!
 
heh yeah... (i get alot more tho hence the saving ( my total refund should be somewhere around $6000-$10,000
 
I was looking at:
**broken link removed**

The macro stuff is 1.2" i think it should be good enough.
 
I was looking at:
**broken link removed**

The macro stuff is 1.2" i think it should be good enough.
Ya, consumers love the S series Elphs' for their very small size and pocketability. They're light and easy to use.

I love the A series cameras for their awesome complete range of settings, including shutter-priority, aperture priority and full manual (the Elph may have some of these), for their ability to run on AA alkalines in a pinch (if your NIMH cells run out that day), for their nice grippy size and weight, their big swivel display and their ability to use add-on lenses & filters.

You pick what works for you.
 
i can get the Powershot A650 brand new for about $290 which is not bad...
Are you selling yours?
 
i can get the Powershot A650 brand new for about $290 which is not bad...
Are you selling yours?
Considering it. But on the other hand I'm not really all excited about burning a couple grand on a fancy SLR and lenses, what with the state of the economy. I might be living in my van this time next year. You never know...

I gave away my A80 (to my mom), but I don't really want to give away the 650 yet. It's not obsolete like my A80 was when I gave it to her.
 
heh i totally understand. I dont think no one would like to live in a van (unless on tour )

Ill see what cameras are available around my location in pawn shops perhaps i might find something good!
 
The is selling like hotcakes. It came back into stock about Christmas and is out of stock again. Sparkfun had about 70 units in stock when I noticed they had inventory. Not bad for two or three weeks of sales, that does not count units sold on the makers website.

This product was developed and marketed by one person who knew hardware and C#.

Just goes to show what you can do if you try.

So far I LIKE mine.

3v0

Some photos and a few words about the Saleae Logic have been posted on my site. Have a look if you're interested in the Logic. Nice product!
 
Last edited:
cool. I hit a snag in the road. No work until February so i have to save everything i can to pay the bills i hate this kind of work. Thats cool info tho. I thought it was a company but to be developed by 1 person and marketed it seems to have grown a lot.

I guess we can all learn something from this person.
 
So far I LIKE mine.
It's excellent, huh? Mine has saved me from hours of confusion multiple times already. Wonderful tool!

EDIT: Funny story. I connected it up to check something on 4 pins one day. Got freaky strange output from it, and signal on the unconnected probes too. I spent maybe a half hour trying to decipher the output and finally gave up and fixed it another way.

So as I'm shutting down for the night I glance over at the Logic... and see that the USB hadn't been plugged in all along! (slaps forehead!)
 
Last edited:
cool. I hit a snag in the road. No work until February so i have to save everything i can to pay the bills i hate this kind of work.
That's half the reason the economy is tanking. Everybody is a bit freaked and afraid to spend. I've spent barely anything in the last six months. Putting every penny I can in the bank (we have safer banks than you in the US ). You guys should be putting it under a mattress or into physical gold and holding it yourself.
 
heh i rather move to Canada for a bit open a account and move back. my brother in-law has family in Canada i think near Toronto and visits frequently... I would love to take a trip out there maybe around May this year who knows!
 

We've had the busiest Christmas and New Year in the history of the company, it strikes me that people are spending their money rather than risking leaving it in the bank

Apparently home safe sales have rocketed massively as well
 


lol i just noticed this... you have no idea how many times this has happened to me in different ways.

1. Ive tried soldering with a soldering iron that wasnt plugged in.
2. Turn on pc with no power cord.
3. Power up circuit with no PIC in it lol.
4. used bathroom forgot to pickup the lid lol
5. talked in a mic recording video without mic being plugged in
6. typed some of this with out even typing in the right textbox lol

its crazy how things are.

When income tax comes in i decided to save more than i thought but in home. I might spend about $500 on cloths and $500 on my PC and PIC items and the rest gets saved. Since work is sluggish and damn economy sux right now.

Question: ... is it always cold in canada? (i know its probably a stupid question)
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…